home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / gopher / Rice_CMS / gopher24.readcard < prev    next >
Encoding:
Text File  |  1993-01-25  |  851.3 KB  |  10,763 lines

  1. :READ  GOPHER24 FILELIST A1 TMP200 01/25/93 18:05:24                            
  2. *                                                                               
  3. * This is CMS Gopher 2.4 (v2r4), client only. (beta)                            
  4. * If you have any questions,  send e-mail to TROTH@RICEVM1.RICE.EDU.            
  5. *                                                                               
  6.                                                                                 
  7. *                                                                               
  8. *       Copyright 1992 Richard M. Troth.   This software was developed          
  9. *       with resources provided by Rice University and is intended              
  10. *       to serve Rice's user community.   Rice has benefitted greatly           
  11. *       from the free distribution of software,  therefore distribution         
  12. *       of unmodified copies of this material is not restricted.                
  13. *       You may change your own copy as needed.   Neither Rice                  
  14. *       University nor any of its employees or students shall be held           
  15. *       liable for damages resulting from the use of this software.             
  16. *                                                                               
  17.                                                                                 
  18. *                                                                               
  19. * You will need RXSOCKET and CMS Pipelines.     (5785-RAC)                      
  20. * You will need VM TCP/IP, V2 or later.         (5735-FAL)                      
  21. *                                                                               
  22. * This file is in CMS TAR compatible format.                                    
  23. * (it was, in fact, used to create gopher24.tar)                                
  24. *                                                                               
  25. *     filename filetype fm relative_path (may be verbose)                       
  26.       GOPHER24 FILELIST *                                                       
  27.       GOPHER24 README   *                                                       
  28. *                                                                               
  29. * client:                                                                       
  30.       GOPHER   EXEC     *                                                       
  31.       GOPCLI   EXEC     *                                                       
  32.       GOPCLINI EXEC     *                                                       
  33.       GOPCLISX REXX     *                                                       
  34.       GOPCLITM REXX     *                                                       
  35.       GOPCLIST REXX     *                                                       
  36.       GOPCLIMB REXX     *                                                       
  37.       GOPCLIUI REXX     *                                                       
  38.       GOPCLITX REXX     *                                                       
  39.       GOPCLIFV REXX     *                                                       
  40.       GOPCLIGV REXX     *                                                       
  41.       GOPCLIFI EXEC     *                                                       
  42.       GVM      EXEC     *                                                       
  43.       GVM      DIRECT   *                                                       
  44. *                                                                               
  45. * server:                                                                       
  46.       GOPHERD  EXEC     *                                                       
  47.       GOPHERD  CONFIG   *                                                       
  48.       GOPSRV   EXEC     *                                                       
  49.       GOPSRVLS REXX     *                                                       
  50.       GOPSRVRP REXX     *                                                       
  51.       GOPSRVMB REXX     *                                                       
  52.       GOPSRVGL REXX     *                                                       
  53.       GOPSRVAU EXEC     *                                                       
  54.       GOPSRVYS REXX     *                                                       
  55.       GOPHERD  DIRECT   *                                                       
  56. *                                                                               
  57. * support:                                                                      
  58.       EXPAND   REXX     *                                                       
  59.       PRINT    REXX     *                                                       
  60.       A2E      REXX     *                                                       
  61.       E2A      REXX     *                                                       
  62.       TCPA2E   REXX     *                                                       
  63.       TCPE2A   REXX     *                                                       
  64.       STANDARD TCPXLATE *                                                       
  65.       STANDARD TCPXLBIN *                                                       
  66. *                                                                               
  67. * oh joy! a message repository:                                                 
  68.       GOPUME   MESSAGES *                                                       
  69. *     GOPUME   MSGAMENG *                                                       
  70.       GOPUME   TEXT     *                                                       
  71. *     GOPUME   TXTAMENG *                                                       
  72. *                                                                               
  73. * files for using XEDIT as your file viewer:                                    
  74.       GOPXEDPR XEDIT    *                                                       
  75.       GOPXEDII XEDIT    *                                                       
  76. *                                                                               
  77. * a bookmark migration aid:                                                     
  78.       GOPHMARK EXEC     *                                                       
  79. *                                                                               
  80. * support modules:                                                              
  81.       RXSOCKET MODULE   *                                                       
  82.       RXSOCKET MODULESP *                                                       
  83.       DISKWRIT MODULE   *                                                       
  84. *     _REFRESH EXEC     *                                                       
  85. *                                                                               
  86. * INDEX generator and search engine:  (thanks, Yossie!)                         
  87.       WISHLG   MODULE   *                                                       
  88.       WISHLP   MODULE   *                                                       
  89. *                                                                               
  90. * CSO PhoneBook lookups:  (thanks, Nick!)                                       
  91.       PH       EXEC     *                                                       
  92. *                                                                               
  93. * a tool for browsing Gopher FILELISTs on-line:                                 
  94.       GL       EXEC     *                                                       
  95. *                                                                               
  96. * a tool for dumping gopherspace in line-mode:                                  
  97.       GOPHERCAT EXEC    *                                                       
  98. *                                                                               
  99. * a tool for generating search (WISHLP) indices and other things:               
  100.       GOPGEN    EXEC    *                                                       
  101.       GOPGENFL  REXX    *                                                       
  102. *                                                                               
  103. * help files:                                                                   
  104.       GOPHER   HELPCMS  *                                                       
  105.       BROWSER  HELPGOPHER *                                                     
  106.       VIEWER   HELPGOPHER *                                                     
  107.       GOP000I  HELPMSG  *                                                       
  108.       GOPGEN   HELPCMS  *                                                       
  109. *                                                                               
  110. * serving CMS HELP via Gopher:                                                  
  111.       GOPHERDH REXX     *                                                       
  112.       GOPHERDI REXX     *                                                       
  113.       HELP     NAMES    *                                                       
  114.       NEWS     NAMES    *                                                       
  115. *                                                                               
  116. * general information:                                                          
  117.       GOPHER   PROTOCOL *                                                       
  118.       GOPHERT  GIF      *                                                       
  119.       GOPHER  COPYRIGHT *                                                       
  120. *                                                                               
  121. * If you pick-up RXSOCKET or DISKWRIT from a UNIX FTP host,  you must           
  122. * "de-block" them back into their CMS form (record oriented) with:              
  123. *                                                                               
  124. *   PIPE DISK RXSOCKET U-MODULE | DEBLOCK CMS | DISK RXSOCKET MODULE            
  125. *   PIPE DISK DISKWRIT U-MODULE | DEBLOCK CMS | DISK DISKWRIT MODULE            
  126. *                                                                               
  127. * sequecned sources:                                                            
  128. * (modify these, not the EXECs and REXX pipes)                                  
  129.       GOPCLI   $EXEC     *                                                      
  130.       GOPCLINI $EXEC     *                                                      
  131.       GOPCLISX $REXX     *                                                      
  132.       GOPCLITM $REXX     *                                                      
  133.       GOPCLIST $REXX     *                                                      
  134.       GOPCLIMB $REXX     *                                                      
  135.       GOPCLIUI $REXX     *                                                      
  136.       GOPCLITX $REXX     *                                                      
  137.       GOPCLIFV $REXX     *                                                      
  138.       GOPCLIGV $REXX     *                                                      
  139.       GOPCLIFI $EXEC     *                                                      
  140. *                                                                               
  141.       GOPSRV   $EXEC     *                                                      
  142.       GOPSRVLS $REXX     *                                                      
  143.       GOPSRVRP $REXX     *                                                      
  144.       GOPSRVMB $REXX     *                                                      
  145.       GOPSRVGL $REXX     *                                                      
  146.       GOPSRVAU $EXEC     *                                                      
  147.       GOPSRVYS $REXX     *                                                      
  148. *                                                                               
  149.       VMGOPHER CNTRL     *                                                      
  150. *                                                                               
  151. :READ  GOPHER24 README   A1 TMP200 01/22/93 18:25:16                            
  152.                                                                                 
  153. WELCOME                                                                         
  154.                                                                                 
  155. Welcome to GopherSpace!   I hope you enjoy your trek.                           
  156.                                                                                 
  157. The InterNet Gopher  (or just "gopher" for short)  is a simple                  
  158. information dispersal tool based on TCP/IP.   It is an example                  
  159. of the kind of seemless interoperability that is possible                       
  160. when we (programmers) actually try to do things right.                          
  161. The Gopher protocol doesn't care about host operating systems,                  
  162. their file storage formats,  character sets,  or command suite                  
  163. (or lack thereof).                                                              
  164.                                                                                 
  165. CMS Gopher is based on three very strong tools:  the REXX language,             
  166. Arty Ecock's RXSOCKET,  and CMS Pipelines.   As a programmer,                   
  167. I literally went to tears over how well these three work together.              
  168.                                                                                 
  169. More warm fuzzies later.   You need to unpack this thing.                       
  170.                                                                                 
  171.  ------  ------  ------  ------  ------  ------  ------  ------  ------         
  172.                                                                                 
  173. UNPACKING                                                                       
  174.                                                                                 
  175. CMS Gopher is packaged in several forms.   Pick your favourite                  
  176. de-archival tool and start unpacking.   Both server and client                  
  177. can reside on the same disk.   (that's how they are at Rice)                    
  178.                                                                                 
  179. CMS TAR: (Rick's choice)                                                        
  180.                                                                                 
  181. Enter the command:      tar xvf gopher24 = = fm                                 
  182.                                                                                 
  183. where  fm  is the filemode of the disk or SFS directory to hold Gopher.         
  184.                                                                                 
  185. CARDDUMP: (Cornell 'CARD' format)                                               
  186.                                                                                 
  187. You may need to reblock the binary file with  ... | FBLOCK 80 | ... ,           
  188. then  PUNCH  it to yourself,  order it to the top of your reader,               
  189. and   CARD LOAD * * fm   to get the package onto the disk you want.             
  190.                                                                                 
  191.         CP SPOOL PUNCH TO *                                                     
  192.         PUNCH GOPHER24 CARDDUMP (NOHEADER                                       
  193.         CP ORDER RDR spoolid                                                    
  194.         CARD LOAD * * fm                                                        
  195.                                                                                 
  196. READCARD:                                                                       
  197.                                                                                 
  198. This is a plain-text archive,  which means that executables are                 
  199. not included.   You'll have to acquire RXSOCKET MODULE and other                
  200. binaries via some other means.   You'll have to generate the                    
  201. message repository manually.   PUNCH the file to yourself with the              
  202. (NOHEADER option,  order it to the top of your reader,  then                    
  203. READCARD * * fm,  where  fm  is the disk or SFS directory where you             
  204. intend to load CMS Gopher.                                                      
  205.                                                                                 
  206.         CP SPOOL PUNCH TO *                                                     
  207.         PUNCH GOPHER24 READCARD (NOHEADER                                       
  208.         CP ORDER RDR spoolid                                                    
  209.         READCARD * * fm                                                         
  210.                                                                                 
  211. LISTSERV:                                                                       
  212.                                                                                 
  213. Send a message (with either TELL or MAIL) to LISTSERV@RICEVM1                   
  214. (LISTSERV@RICEVM1.RICE.EDU),                                                    
  215.                                                                                 
  216.         get gopher24 package                                                    
  217.                                                                                 
  218. In CMS that's:   TELL LISTSERV AT RICEVM1 GET GOPHER24 PACKAGE                  
  219.                                                                                 
  220. LISTSERV will send you everything.   No archive extraction needed.              
  221.                                                                                 
  222.  ------  ------  ------  ------  ------  ------  ------  ------  ------         
  223.                                                                                 
  224. SETTING UP THE CLIENT                                                           
  225.                                                                                 
  226. You may have some special method of giving users access to your                 
  227. CMS applications.   At Rice,  we keep most applications on their own            
  228. minidisk,  and leave a  "wrapper" EXEC on a public,  always accessed            
  229. minidisk  (our X disk).                                                         
  230.                                                                                 
  231. The client is GOPCLI.   Whatever wrapper you create should check for            
  232. GOPCLI EXEC and access the right disk or SFS directory if it's missing.         
  233.                                                                                 
  234. You may want to tailor a couple of environment variables.   There's no          
  235. CONFIG file for the client in CMS Gopher 2.4.   All configuration data          
  236. are kept in user GLOBALVs.   See  HELP GOPHER  for a list of user-settable      
  237. Global Variables.   HOST and NAME are two that many people like to predefine.   
  238. HOST is the TCP/IP host computer where your  "top level"  gopher server runs.   
  239. NAME is the name of that  "top level"  menu.   (there's no way in the           
  240. Gopher protocol for a menu to name itself;  all menus and plain files           
  241. are named by the menu that references them,  so you need to set NAME            
  242. or you'll get  "(root menu)",  harmless but ugly)                               
  243.                                                                                 
  244. Note that the client reserves the fileid  VMGOPHER DOCUMENT  for times          
  245. when it needs to write a file to CMS disk and can't use the name                
  246. provided by the current gopher server.                                          
  247.                                                                                 
  248. PICTURES                                                                        
  249.                                                                                 
  250. CMS Gopher 2.4 supports the gopher "image" (type I) files.   Presently,         
  251. the only format displayable is GIF files using the VMGIF package available      
  252. from the fine folks at BLEKUL11.                                                
  253.                                                                                 
  254.  ------  ------  ------  ------  ------  ------  ------  ------  ------         
  255.                                                                                 
  256. SETTING UP THE SERVER                                                           
  257.                                                                                 
  258. The server is GOPSRV.   Setting it up is trickier than setting up the           
  259. client because you not only have to create a virtual machine for it to          
  260. run in,  but you also have to take the time to structure your gopher data       
  261. nicely.   See  GOPHERD DIRECT for an example CP Directory entry.                
  262. You can have multiple gopher servers.                                           
  263.                                                                                 
  264. If you don't have SFS,  you can create a hierarchical set of menus using        
  265. FILELISTs.   Some VMers insist on using FLIST.   They say it's faster           
  266. than FILELIST.   Fine.   But FILELIST lets you save and load FILELISTs          
  267. such that you can easily bundle files together almost as easily as with         
  268. true directories.   If you do have SFS,  you can let it do the work of          
  269. maintaining your menu hierarchy.                                                
  270.                                                                                 
  271. Gopher FILELISTs are made up of lines of the form:                              
  272.                                                                                 
  273.         fn  ft  fm  path  "name"  type                                          
  274.                                                                                 
  275.                 where fn/ft/fm are the filename, filetype, and filemode         
  276. of the file being referenced.   The path is really only the last partof         
  277. the gopher "selector string" pointing to this file.   The paths of all          
  278. parent menus are automatically prepended.   The name (must be in quotes)        
  279. is what the user sees in the menu referencing this file.   The type is a        
  280. one-digit type indicator,  any of:                                              
  281.                                                                                 
  282.                 0       this file is plain-text                                 
  283.                 1       this item is a menu                                     
  284.                 4       this is a Macintosh file                                
  285.                 5       this is an MS-DOS file                                  
  286.                 6       this is a UUEncoded file                                
  287.                 7       this item is a search on a menu                         
  288.                 9       this is a binary file                                   
  289.                 I       image (graphic; typically GIF)                          
  290.                 s       sound                                                   
  291.                                                                                 
  292. There are other types,  but these are the ones most useful in FILELISTs.        
  293.                                                                                 
  294. Everyhing except the filename is optional.   Filetype, filemode, path,          
  295. name and type may all be omitted,  in which case the server will choose.        
  296. The first character of each line in a Gopher FILELIST must be either            
  297. a blank or an asterisk,  the latter denoting a comment.   With care,            
  298. you can in fact use a Gopher FILELIST as input to CMS' FILELIST EXEC)           
  299.                                                                                 
  300. I mentioned the menu type, digit 1.   Please note that you do NOT specify       
  301. a menu within a menu by marking some file as type 1,  but rather by using       
  302. a special filetype "*".   The server will automatically mark it as type 1.      
  303.                                                                                 
  304. The  "root"  menu is defined by <userid> FILELIST,  where <userid>              
  305. is the name of your gopher server virtual machine,  typically GOPHERD.          
  306. You can override this and other parameters in GOPHERD CONFIG.                   
  307.                                                                                 
  308. So,  making a long story longer,  to setup your gopher server,  define          
  309. virtual machine GOPHERD,  give it access to your local gopher disk,             
  310. create GOPHERD FILELIST listing one or more files you wish to serve-out,        
  311. then  CP AUTOLOG GOPHERD.                                                       
  312.                                                                                 
  313. There is a CONFIG file,  which you can tailor as needed.   With the 2.4         
  314. server,  the only variables meaningful in the config file are  LOGPIPE,         
  315. PORT,  and  ROOT.   PORT defaults to 70.   ROOT defaults to the virtual         
  316. machine name  (server's userid).   LOGPIPE defaults to CONSOLE.                 
  317.                                                                                 
  318. You will probably want to dedicate port 70 to GOPHERD in your local             
  319. PROFILE TCPIP for you TCPIP service virtual machine.   It's also good           
  320. to have GOPHERD listed as AUTOLOGged by TCPIP.   Neither of these steps         
  321. are required to test GOPHERD;  just run it.   It's pretty harmless.             
  322.                                                                                 
  323. PIPES AND AUTHORIZATIONS                                                        
  324.                                                                                 
  325. A nice way to degrade performance of your gopher server is to create a          
  326. NAMES file for a menu.   In spite of the cost,  this is useful because          
  327. you can control access to and/or define CMS Pipelines specifications for        
  328. menus and items in a NAMES file.                                                
  329.                                                                                 
  330. When the server accesses a directory,  it looks for <menu> NAMES.               
  331. (this works best with FILELISTs;  if you do it for SFS directories,             
  332. consider that the server may access other directories,  releasing the           
  333. one that holds your NAMES file,  as it resolves the selector path string)       
  334. If <menu> NAMES exists,  the server uses NAMEFIND to process it.                
  335. This is best explained by an example:                                           
  336.                                                                                 
  337.                                                                                 
  338.         :nick.myfile   :fn.my   :ft.file                                        
  339.                        :auth..rice.edu deny .cuny.edu .gov allow *              
  340.                        :pipe.CP Q NAMES | SPLIT /,/                             
  341.                                                                                 
  342. For the file  MY FILE,  any host who's InterNet hostname ends in                
  343. ".rice.edu"  (all of the Rice campus)  can read it.   Any host who's            
  344. InterNet hostname ends with  ".cuny.edu"  or  ".gov"  is prohibited.            
  345. Everyone else is then permitted.   If the client host is allowed access,        
  346. then instead of reading the file  MY FILE,  the server sends the output         
  347. of the pipeline  CP Q NAMES | SPLIT /,/  to the client.                         
  348.                                                                                 
  349. This can get quite sophisticated.   No,  you do not have to have both           
  350. an auth and a pipe in the NAMES file entry.   You can have either one           
  351. or neither.   And know that CMS NAMEFIND does not provide a way to              
  352. specify the filemode of the NAMES file,  so be careful about menu               
  353. name collisions.                                                                
  354.                                                                                 
  355. You can also specify  host, port, path, name, and type  in a NAMES file.        
  356. This means that you can use NAMES files in place of GOPHER (link) files,        
  357. but remember that NAMEFIND is going to cost you.                                
  358.                                                                                 
  359. Link files?   They let you point to other gopher servers.                       
  360. See the Q&A section below,  otherwise this section will go on forever.          
  361.                                                                                 
  362. SEARCH ITEM                                                                     
  363.                                                                                 
  364. Creating a search item in a menu is easy.   Set it up just like you             
  365. would any other sub-menu,  but mark it as Type 7.   Something like:             
  366.                                                                                 
  367.         MYSEARCH FILELIST * whatever "My Own Search Item" 7                     
  368.                                                                                 
  369.                 in the parent menu's FILELIST,  or,                             
  370.                                                                                 
  371.         :nick.whatever :fn.mysearch :ft.filelist :type.7                        
  372.                                                                                 
  373. There's no reason why you can't have the menu as a whole available              
  374. right next to the searched version,  like:                                      
  375.                                                                                 
  376.         MYSEARCH FILELIST * whatever "My Own Search Item" 7                     
  377.         MYSEARCH FILELIST * whatever "My Own Search Item (not indexed)"         
  378.                                                                                 
  379. You must also create an index file for this menu.   The easiest way is          
  380. by using GOPGEN.   GOPGEN is primarily a tool for making your own mods          
  381. to CMS Gopher,  but it also performs the right incantation on WISHLG            
  382. (thank's Yossie) to create an index for you.   The server then will             
  383. invoke WISHLP (thank's again, Yossie) to list the files that match              
  384. the client's search expression.                                                 
  385.                                                                                 
  386.         GOPGEN INDEX MYSEARCH                                                   
  387.                                                                                 
  388. MYSEARCH FILELIST must exist.   All of the files it lists must exist.           
  389. You must then put the index file,  MYSEARCH GOPINDEX,  where the server         
  390. will access it.                                                                 
  391.                                                                                 
  392.  ------  ------  ------  ------  ------  ------  ------  ------  ------         
  393.                                                                                 
  394. FUNCTIONS OF FILES                                                              
  395.                                                                                 
  396. Here's a list of most of the files in the package and their function:           
  397.                                                                                 
  398.       GOPHER   EXEC     "wrapper" EXEC; ensures product disk accessed           
  399.       GOPCLI   EXEC     the client                                              
  400.       GOPCLINI EXEC     client initialization (called once from GOPCLI)         
  401.       GOPCLTCP REXX     handles all TCP/IP work for the client                  
  402.       GOPCLITM REXX     decides what how a given item should be processed       
  403.       GOPCLIST REXX     displays connection status,  "Reading ...",  etc        
  404.       GOPCLIMB REXX     menu browser                                            
  405.       GOPCLIUI REXX     user input (prompting)                                  
  406.       GOPCLTXT REXX     reformats plain-text                                    
  407.       GOPCLIFV REXX     file viewer; may be used stand-alone                    
  408.       GOPCLIGV REXX     graphics viewer; presently GIFs only                    
  409.       GOPCLIFI EXEC     returns legal CMS fileid from a gopherspace path        
  410.       GVM      EXEC     "DIALed Gopher" client; calls GOPHER to call GOPCLI     
  411.       GVM      DIRECT   CP Directory entry for the DIALed Gopher                
  412.                                                                                 
  413.       GOPHERD  EXEC     "wrapper" EXEC for the server; write your own           
  414.       GOPSRV   EXEC     the server                                              
  415.       GOPSRVLS REXX     lists files and menus (menus in LISTFILE format)        
  416.       GOPSRVRP REXX     gopher path resolution; uses GOPSRVLS output            
  417.       GOPSRVMB REXX     menu builder                                            
  418.       GOPSRVGL REXX     gopher "link" processor                                 
  419.       GOPSRVAU EXEC     performs authorization check                            
  420.       GOPSRVFM EXEC     dummy filemode function for server                      
  421.       GOPHERD  DIRECT   CP Directory entry for the server                       
  422.                                                                                 
  423.       EXPAND   REXX     expands TAB characters                                  
  424.       PRINT    REXX     similar to CMS PRINT, but a pipe                        
  425.       A2E      REXX     translate ASCII to EBCDIC                               
  426.       E2A      REXX     translate EBCDIC to ASCII                               
  427.       TCPA2E   REXX     A2E, but follows TCP/IP translate tables                
  428.       TCPE2A   REXX     E2A, "   "       "      "         "                     
  429.       STANDARD TCPXLATE suggested ASCII <---> EBCDIC translate tables           
  430.       STANDARD TCPXLBIN binary object built from above TCPXLATE                 
  431.                                                                                 
  432.       GOPUME   MESSAGES message repository source                               
  433.       GOPUME   TEXT     message repository object                               
  434.                                                                                 
  435.       GOPXEDPR XEDIT    XEDIT profile for XEDIT used as file viewer             
  436.       GOPXEDII XEDIT    "item info" command for XEDIT as file viewer            
  437.                                                                                 
  438.       GOPHMARK EXEC     migrates bookmars from 2.3                              
  439.                                                                                 
  440.       RXSOCKET MODULE   Arty's wonderful CMS Socket tool                        
  441.       RXSOCKET MODULESP VM/SP and VM/HPO version of above                       
  442.       DISKWRIT MODULE   minidisk need reACCESSing?                              
  443.       WISHLP   MODULE   Yossie's *fast* search engine                           
  444.       WISHLG   MODULE   index builder for above                                 
  445.                                                                                 
  446.       PH       EXEC     Nick LaFlamme's CSO/qi (phonebook) client               
  447.                                                                                 
  448.       GL       EXEC     primitive tool for browsing CMS Gopher FILELISTs        
  449.                                                                                 
  450.       GOPHERCAT EXEC    dumps gopherspace files right onto your console         
  451.                                                                                 
  452.       GOPHERDH REXX     a pipeline stage that interprets CMS HELP               
  453.       HELP     NAMES    defines HELP menu to the server using above             
  454.                                                                                 
  455.  ------  ------  ------  ------  ------  ------  ------  ------  ------         
  456.                                                                                 
  457. There is a discussion list,  VMGOPHER@PUCC.Princeton.EDU.                       
  458.                                                                                 
  459. There is another CMS Gopher (both server and client),  popularly called         
  460. "the Vienna Gopher",  available from Gerhard Gonter <GONTER@AWIWUW11>.          
  461.                                                                                 
  462.  ------  ------  ------  ------  ------  ------  ------  ------  ------         
  463.                                                                                 
  464. Q:      The basics, documents and FILELIST menus, is fairly easy to grasp,      
  465.         but the relationship of a NAMES file and its entries to a FILELIST      
  466.         file and its entries is not at all evident to the poor soul that        
  467.         just wants to provide an information service without much time          
  468.         invested (I.e., without subscribing to VMGOPHER).                       
  469.                                                                                 
  470. A:      The easiest way to start is just name some plain-text files in          
  471.         GOPHERD FILELIST  (which are available to your GOPHERD service          
  472.         machine on an accessed disk or SFS directory).   Then after you're      
  473.         comfortable with that,  try some "links"  (filetype GOPHER) and         
  474.         sub-menus  (filetype FILELIST).   Then get into NAMES files.            
  475.                                                                                 
  476. Q:      How to I point to another server/menu?                                  
  477.                                                                                 
  478. A:      The easiest way is with a "link" file  (filetype GOPHER).               
  479.         When a link file shows-up in any FILELIST,  the contents of             
  480.         that file are read and the information specified is presented           
  481.         to the client for that particular menu item.                            
  482.                                                                                 
  483.         The contents of a GOPHER (link) file are the same as                    
  484.         for a UNIX server link file,  of the form:                              
  485.                                                                                 
  486.                 name=Rice University CMS Gopher server                          
  487.                 host=ricevm1.rice.edu                                           
  488.                 port=70                                                         
  489.                 path=1/                                                         
  490.                 type=1                                                          
  491.                                                                                 
  492.         As of 2.4,  GOPHER file can have more than one link in it.              
  493.                                                                                 
  494. Q:      How does a GOPHER file differ from a "link" in a NAMES file?            
  495.                                                                                 
  496. A:      The NAMES file is far more extensive.   (and exPensive)                 
  497.         With the CMS Gopher server,  you don't use "link" files to              
  498.         override the characteristics of other files in the menu  (as you        
  499.         would with a UNIX server).   With the CMS server,  GOPHER (link)        
  500.         files are exclusively used to reference other network (usually          
  501.         non-local) resources,  while the NAMES file may apply to local          
  502.         files,  which reside on your system OR to remote services.              
  503.                                                                                 
  504. Q:      Some folks have made it seem that their gopher server files             
  505.         are free for the taking ...  is there a gopher feature                  
  506.         to pull these in?                                                       
  507.                                                                                 
  508. A:      To "receive" (keep) an item,  press PF5.   The receive function         
  509.         will not overwrite an existing file  (though you can still              
  510.         view & SAVE from XEDIT).                                                
  511.                                                                                 
  512. Q:      GOPHERD should document DISKWRIT in the prolog.                         
  513.                                                                                 
  514. A:      GOPHERD uses DISKWRIT to perform the same "reaccess" trick that         
  515.         GONE EXEC does when you reconnect.   If disks appear to have            
  516.         changed,  they are reACCESSed so that the server has the latest         
  517.         revision of any files on those minidisks.                               
  518.                                                                                 
  519. Q:      Why are the "STANDARD" translate-table files provided?                  
  520.         Are these for use with the server?                                      
  521.                                                                                 
  522. A:      Both server and client.                                                 
  523.         The default ASCII <---> EBCDIC translation in VM TCP/IP (FAL)           
  524.         is not 100% correct for the majority of the VM/UNIX/VMS/DOS/Mac         
  525.         world we live in.   STANDARD TCPXLATE and TCPXLBIN provide              
  526.         a 1-for-1 translation between  de-facto "network EBCDIC"                
  527.         (codepage 1047)  and  "extended ASCII"  (ISO 8859-1).                   
  528.                                                                                 
  529. Q:      If PhoneBk and Search are available, how do we use them?                
  530.                                                                                 
  531. A:      Presently,  CMS GopherD does not support PhoneBk and Search engines.    
  532.         The client (GOPCLI) is happy to utilize such servers on other hosts.    
  533.                                                                                 
  534. Q:      Some GOPHERs restrict access or output to some clients;  how?           
  535.                                                                                 
  536. A:      Specify an "auth" value in the NAMES file.   The tag :auth.             
  537.         allows for control over any object in a menu  (defined by a             
  538.         FILELIST and/or NAMES file),  even the menu itself.                     
  539.                                                                                 
  540. Q:      Is there anything different about your RXSOCKET?                        
  541.                                                                                 
  542. A:      RXSOCKET is supplied because Gopher requires it.                        
  543.         RXSOCKET was created by Arty Ecock.   He maintains it.                  
  544.         Rice doesn't have any mods to RXSOCKET,  and Gopher doesn't             
  545.         need any special treatment from RXSOCKET.   If you find an              
  546.         RXSOCKET packaged with CMS Gopher to be out-of-date,  by all            
  547.         means,  use the current one or get the latest from Arty.                
  548.                                                                                 
  549.         If you pick-up RXSOCKET MODULE from a UNIX FTP host,  you must          
  550.         "deblock" it back into its CMS form (record oriented) with:             
  551.                                                                                 
  552.         PIPE DISK RXSOCKET U-MODULE | DEBLOCK CMS | DISK RXSOCKET MODULE        
  553.                                                                                 
  554.  ------  ------  ------  ------  ------  ------  ------  ------  ------         
  555.                                                                                 
  556. Thanks to:                                                                      
  557.                                                                                 
  558. Yossie Silverman,  Jim Gerland,  Arty Ecock,  Serge Goldstein,                  
  559. Chuck Boeheim,  Wayne Smith,  Jim Colten,  Nick LaFlamme,                       
  560. Rich Wiggins,  Martha McConaghy,  John Hartmann,  Melinda Varian,  ...          
  561.                                                                                 
  562. (this list continues to grow,  and some have surely been left out)              
  563.                                                                                 
  564. :READ  GOPHER   EXEC     A1 TMP200 01/12/93 17:09:27                            
  565. /*                                                                              
  566.  *        Name: GOPHER EXEC                                                     
  567.  *     Purpose: VM InterNet Gopher client "wrapper" EXEC                        
  568.  *      Author: Rick Troth, Rice University, Information Systems                
  569.  *        Date: 1992-Dec-23                                                     
  570.  *                                                                              
  571.  *        Note: Tailor this locally to your own OBTAIN/DROP conventions         
  572.  *                                                                              
  573.  *        Note: Thanks to Nick LaFlamme for the linemode catcher.               
  574.  */                                                                             
  575.                                                                                 
  576. Parse Source system .                                                           
  577. If system ^= "CMS" Then Do                                                      
  578.     Say "CMS Gopher does not run on" system                                     
  579.     Exit -1                                                                     
  580.     End  /*  If  ..  Do  */                                                     
  581.                                                                                 
  582. Address "COMMAND"                                                               
  583.                                                                                 
  584. 'PIPE COMMAND QUERY DISPLAY'                                                    
  585. If rc ^= 0 Then Do                                                              
  586.     drc = rc                                                                    
  587.     'XMITMSG 523'                                                               
  588.     Say "CMS Gopher requires a full-screen terminal."                           
  589.     Exit drc                                                                    
  590.     End  /*  If  ..  Do  */                                                     
  591.                                                                                 
  592. 'STATE GOPCLI EXEC *'                   /*  this is how we access     */        
  593. If rc ^= 0 Then 'EXEC OBTAIN GOPHER'    /*  applications on RICEVM1   */        
  594.                                                                                 
  595. 'GLOBALV SELECT GOPHER GET HOST'                                                
  596. If host = "" Then host = "cwis.rice.edu"                                        
  597. 'GLOBALV SELECT GOPHER PUTP HOST'                                               
  598.                                                                                 
  599. 'GLOBALV SELECT GOPHER GET NAME'                                                
  600. If name = "" Then                                                               
  601.         name = "RiceInfo"                                                       
  602. /*      name = "Rice University Campus-Wide Information System"       */        
  603. 'GLOBALV SELECT GOPHER PUTP NAME'                                               
  604.                                                                                 
  605. Parse Arg argstring                                                             
  606. 'EXEC GOPCLI' argstring                                                         
  607.                                                                                 
  608. /*  'EXEC DROP GOPHER'  */                                                      
  609.                                                                                 
  610. Exit rc                                                                         
  611.                                                                                 
  612. :READ  GOPCLI   EXEC     A1 TMP200 01/25/93 01:09:27                            
  613. /*                                                                              
  614.  *        Name: GOPCLI EXEC                                                     
  615.  *              VM TCP/IP Network GOPHER Client                                 
  616.  *      Author: Rick Troth, Rice University, Information Systems                
  617.  *              Major thanks to Arty Ecock for the wonderful RXSOCKET.          
  618.  *              Thanks to Serge Goldstein for help with many things.            
  619.  *        Date: 1992-Dec-23                                                     
  620.  */                                                                             
  621.                                                                                 
  622. /*                                                                              
  623.  *      Copyright 1992 Richard M. Troth.   This software was developed          
  624.  *      with resources provided by Rice University and is intended              
  625.  *      to serve Rice's user community.   Rice has benefitted greatly           
  626.  *      from the free distribution of software,  therefore distribution         
  627.  *      of unmodified copies of this material is not restricted.                
  628.  *      You may change your own copy as needed.   Neither Rice                  
  629.  *      University nor any of its employees or students shall be held           
  630.  *      liable for damages resulting from the use of this software.             
  631.  */                                                                             
  632.                                                                                 
  633. /*                                                                              
  634.  *       Calls:                                                                 
  635.  *              RXSOCKET MODULE   -- for TCP/IP network services                
  636.  *              PIPE     MODULE   -- for various I/O functions                  
  637.  *              GLOBALV           -- for temp and perm global vars              
  638.  *              XMITMSG           -- for all message output                     
  639.  *              VM TCP/IP, V2 or later (through RXSOCKET)                       
  640.  *                                                                              
  641.  *              GOPCLINI EXEC     -- to initialize many things                  
  642.  *              GOPCLITM REXX     -- to fetch the first item (a menu)           
  643.  *              GOPCLIMB REXX     -- to display a menu (from bookmarks)         
  644.  *                     both of which call other gems                            
  645.  *                                                                              
  646.  *    perm GVs:                                                                 
  647.  *        HOST  -  the host to connect to for the root menu                     
  648.  *        PORT  -  the port on that host for Gopher service                     
  649.  *        PATH  -  the path to the initial menu                                 
  650.  *        NAME  -  the name of the initial menu                                 
  651.  *      TELNET  -  the name of the CMS TELNET command  (user preference)        
  652.  *      TN3270  -  the name of the command for 3270 telnet connections          
  653.  *      VIEWER  -  the CMS command (XEDIT or BROWSE) used to view a file        
  654.  *   BOOKMARK.  -  prefix for all bookmark variables,  where what               
  655.  *                 follows the dot is the name of the bookmark                  
  656.  *                                                                              
  657.  *    temp GVs:                                                                 
  658.  *        TUBE  -  the virtual address of a DIALed terminal (not cons)          
  659.  *      GOPHER  -  the IUCV path name and translate table name                  
  660.  *      PROGID  -  program name                                                 
  661.  *        ITEM  -  a line of "gopher menu data" for the chosen item             
  662.  *         ...                                                                  
  663.  */                                                                             
  664.                                                                                 
  665. Trace "OFF"                                                                     
  666.                                                                                 
  667. Address "COMMAND"                                                               
  668.                                                                                 
  669. 'SET LANGUAGE (ADD GOP USER'                                                    
  670. If rc ^= 0 Then Exit rc                                                         
  671.                                                                                 
  672. 'STATE PIPE MODULE *'                                                           
  673. If rc ^= 0 Then Do                                                              
  674.     qrc = rc                                                                    
  675.     /*  "You must have CMS Pipelines to run CMS Gopher."  */                    
  676.     'XMITMSG 3 (APPLID GOP CALLER CLI ERRMSG'                                   
  677.     Exit qrc                                                                    
  678.     End  /*  If  ..  Do  */                                                     
  679.                                                                                 
  680. /*  Thanks to Nick LaFlamme for the linemode catcher.  */                       
  681. 'PIPE COMMAND QUERY DISPLAY'                                                    
  682. If rc ^= 0 Then Do                                                              
  683.     qrc = rc                                                                    
  684.     'XMITMSG 523 (ERRMSG'       /*  "Typewriter mode"  */                       
  685.     /*  "CMS Gopher requires a full-screen terminal."  */                       
  686.     'XMITMSG 926 (APPLID GOP CALLER CLI ERRMSG'                                 
  687.     Exit qrc                                                                    
  688.     End  /*  If  ..  Do  */                                                     
  689.                                                                                 
  690. 'STATE RXSOCKET MODULE *'                                                       
  691. If rc ^= 0 Then Do                                                              
  692.     qrc = rc                                                                    
  693.     /*  "You must have RXSOCKET to run CMS Gopher."  */                         
  694.     'XMITMSG 1 (APPLID GOP CALLER CLI ERRMSG'                                   
  695.     Exit qrc                                                                    
  696.     End  /*  If  ..  Do  */                                                     
  697.                                                                                 
  698. 'STATE TCPIP DATA *'                                                            
  699. If rc ^= 0 Then Do                                                              
  700.     qrc = rc                                                                    
  701.     /*  "You must have VM TCP/IP V2 to run CMS Gopher."  */                     
  702.     'XMITMSG 2 (APPLID GOP CALLER CLI ERRMSG'                                   
  703.     Exit qrc                                                                    
  704.     End  /*  If  ..  Do  */                                                     
  705.                                                                                 
  706. Parse Arg host port path '(' options ')' .                                      
  707.                                                                                 
  708. If host = "" & options = "" Then 'GLOBALV SELECT GOPHER GET PATH NAME'          
  709.                             Else name = ""                                      
  710.                                                                                 
  711. /* Initialize some variables */                                                 
  712. bookmark = ""                                                                   
  713. bkl  = 0                                                                        
  714. tube = "CONS"                                                                   
  715. quit = 0                                                                        
  716.                                                                                 
  717. /* process options, if any */                                                   
  718. Do While options ^= ""                                                          
  719.     Parse Var options op options                                                
  720.     Upper op                                                                    
  721.     Select  /*  op  */                                                          
  722.         When    Abbrev("TOPIC",op,2)    | ,                                     
  723.                 Abbrev("PATH",op,1)     Then Do                                 
  724.                     path = options                                              
  725.                     options = ""                                                
  726.                     End  /*  When  ..  Do  */                                   
  727.         When    Abbrev("TUBE",op,2)     Then                                    
  728.                     Parse Var options tube options                              
  729.         When    Abbrev("BOOKMARK",op,1) | ,                                     
  730.                 Abbrev("BKMARK",op,3)   Then                                    
  731.                     Parse Var options bookmark options                          
  732.         When    Abbrev("BOOKLIST",op,5) | ,                                     
  733.                 Abbrev("BKLIST",op,3)   Then Do                                 
  734.                     bkl = 1                                                     
  735.                     End  /*  When  ..  Do  */                                   
  736.         When    Abbrev("TITLE",1)       Then Do                                 
  737.                     name = options                                              
  738.                     options = ""                                                
  739.                     End  /*  When  ..  Do  */                                   
  740.         Otherwise 'XMITMSG 3 OP (ERRMSG'                                        
  741.         End  /*  Select  op  */                                                 
  742.     End  /*  Do  While  */                                                      
  743.                                                                                 
  744. /*  initialize many GlobalVs,  including screen stem  */                        
  745. 'EXEC GOPCLINI' tube                                                            
  746.                                                                                 
  747. /*  Now go display first menu or file or bookmark  */                           
  748. Select                                                                          
  749.     When    bkl         Then Call BOOKLIST                                      
  750.     When bookmark ^= "" Then Call BOOKMARK                                      
  751.     Otherwise                Call SHOWITEM                                      
  752.     End  /*  Select  */                                                         
  753.                                                                                 
  754. /*  clear some work GlobalVs  */                                                
  755. 'GLOBALV SELECT GOPHER SET PROGID'                                              
  756. 'GLOBALV SELECT GOPHER SET GOPHER'                                              
  757. 'GLOBALV SELECT GOPHER SET TUBE'                                                
  758. 'GLOBALV SELECT GOPHER SET ITEM'                                                
  759. 'GLOBALV SELECT GOPHER SET COMMAND QUIT'        /* no recursion here */         
  760.                                                                                 
  761. Exit                                                                            
  762.                                                                                 
  763.                                                                                 
  764.                                                                                 
  765. /* ------------------------------------------------------------ SHOWITEM        
  766.  */                                                                             
  767. SHOWITEM:                                                                       
  768.                                                                                 
  769. If host = "" Then 'GLOBALV SELECT GOPHER GET HOST'                              
  770. If host = "" Then host = "gopher.tc.umn.edu"                                    
  771.                                                                                 
  772. If port = "" Then 'GLOBALV SELECT GOPHER GET PORT'                              
  773. If port = "" Then port = 70                                                     
  774.                                                                                 
  775. If name = "" Then Do                                                            
  776.     Parse Value Reverse(path) With name '/' .                                   
  777.     name = Reverse(name)                                                        
  778.     End  /*  If  ..  Do  */                                                     
  779.                                                                                 
  780. If name = "" Then Do                                                            
  781.     'PIPE COMMAND XMITMSG 4 (APPLID GOP CALLER CLI | VAR NAME'                  
  782.     Parse Var name . name                                                       
  783.     End  /*  If  ..  Do  */                                                     
  784.                                                                                 
  785. type = Left(path,1)                                                             
  786. If type = '/' | type = ' ' Then type = '1'                                      
  787.                                                                                 
  788. item = type || name || '05'x || path || '05'x ,                                 
  789.             || host || '05'x || port || '05'x                                   
  790. 'PIPE VAR ITEM | GOPCLITM OPEN | CONSOLE'                                       
  791.                                                                                 
  792. Return                                                                          
  793.                                                                                 
  794.                                                                                 
  795.                                                                                 
  796. /* ------------------------------------------------------------ BOOKMARK        
  797.  *  Present the selected bookmark or fall-back to the list of all.              
  798.  */                                                                             
  799. BOOKMARK:                                                                       
  800.                                                                                 
  801. /*  if bookmark was specified numeric,  just fetch it  */                       
  802. If Datatype(bookmark,'N') Then Do                                               
  803.     i = Trunc(bookmark)                                                         
  804.     'PIPE COMMAND GLOBALV SELECT GOPHER GET BOOKMARK.' || i                     
  805.     If bookmark.i ^= "" Then Do                                                 
  806.         'PIPE VAR BOOKMARK.' || i '| GOPCLITM OPEN | CONSOLE'                   
  807.         Return                                                                  
  808.         End  /*  If  ..  Do  */                                                 
  809.     End  /*  If  ..  Do  */                                                     
  810.                                                                                 
  811.                                                                                 
  812.                                                                                 
  813. /* ------------------------------------------------------------ BOOKLIST        
  814.  *  Present a menu of all of the user's bookmarks.                              
  815.  */                                                                             
  816. BOOKLIST:                                                                       
  817.                                                                                 
  818. If name = "" Then Do                                                            
  819.     /*  extract personal name from NAMES file  */                               
  820.     Parse Value Diag(08,'QUERY USERID') With user . host . '15'x .              
  821.     'PIPE COMMAND NAMEFIND :USERID' user ':NODE' host ,                         
  822.         ':NAME | VAR PERSONAL'                                                  
  823.     If rc = 0 & personal ^= "" Then                                             
  824.         /*  make a title line for bookmark list  */                             
  825.         'PIPE COMMAND XMITMSG 40 PERSONAL' ,                                    
  826.             '(APPLID GOP CALLER CLI NOHEADER | VAR NAME'                        
  827.     End  /*  If  ..  Do  */                                                     
  828.                                                                                 
  829. /*  extract bookmarks from GlobalVs  */                                         
  830. 'PIPE COMMAND GLOBALV SELECT GOPHER LIST' ,                                     
  831.         '| LOCATE 1-10 / BOOKMARK./ | SPEC /=/ 1 2-* NEXT | VARLOAD'            
  832. If ^Datatype(bookmark.0,'N') Then bookmark.0 = 0                                
  833.                              Else bookmark.0 = Trunc(bookmark.0)                
  834.                                                                                 
  835. 'PIPE STEM BOOKMARK. | GOPCLIMB' name '| CONSOLE'                               
  836. If rc ^= 0 Then Return                                                          
  837.                                                                                 
  838. 'GLOBALV SELECT GOPHER GET COMMAND'                                             
  839. Parse Upper Var command verb .                                                  
  840. If Abbrev("QUIT",verb,1) Then Return                                            
  841.                                                                                 
  842. /*  remove any blanked (deleted) bookmarks from the stem  */                    
  843. j = 0                                                                           
  844. 'GLOBALV SELECT GOPHER GET BOOKMARK.0'                                          
  845. Do i = 1 to bookmark.0                                                          
  846.     'GLOBALV SELECT GOPHER GET BOOKMARK.' || i                                  
  847.     If  Symbol("BOOKMARK." || i) = "LIT"    | ,                                 
  848.                       bookmark.i = ""       | ,                                 
  849.                  Left(bookmark.i,1) = 'i'   Then    Iterate                     
  850.     j = j + 1                                                                   
  851.     bookmark.j = bookmark.i                                                     
  852.     'GLOBALV SELECT GOPHER PUTP BOOKMARK.' || j                                 
  853.     End                                                                         
  854. bookmark.0 = j                                                                  
  855. 'GLOBALV SELECT GOPHER PUTP BOOKMARK.0'                                         
  856.                                                                                 
  857. Return                                                                          
  858.                                                                                 
  859. :READ  GOPCLINI EXEC     A1 TMP200 01/22/93 11:48:06                            
  860. /*                                                                              
  861.  *        Name: GOPCLINI EXEC                                                   
  862.  *              CMS InterNet Gopher (client) initialization                     
  863.  *      Author: Rick Troth, Rice University, Information Systems                
  864.  *        Date: 1992-Dec-23, 1993-Jan-22                                        
  865.  */                                                                             
  866.                                                                                 
  867. /*                                                                              
  868.  *      Copyright 1992 Richard M. Troth.   This software was developed          
  869.  *      with resources provided by Rice University and is intended              
  870.  *      to serve Rice's user community.   Rice has benefitted greatly           
  871.  *      from the free distribution of software,  therefore distribution         
  872.  *      of unmodified copies of this material is not restricted.                
  873.  *      You may change your own copy as needed.   Neither Rice                  
  874.  *      University nor any of its employees or students shall be held           
  875.  *      liable for damages resulting from the use of this software.             
  876.  */                                                                             
  877.                                                                                 
  878. Trace "OFF"                                                                     
  879.                                                                                 
  880. Address "COMMAND"                                                               
  881.                                                                                 
  882. Parse Upper Arg . '(' opts ')' .                                                
  883. fsin = 1;   load = 1                                                            
  884. Do While opts ^= ""                                                             
  885.     Parse Var opts op opts                                                      
  886.     Select  /*  op  */                                                          
  887.         When  Abbrev("UNLOAD",op,3)     Then  Signal  UNLOAD                    
  888.         When  Abbrev("NOSCREEN",op,3)   Then  fsin = 0                          
  889.         When  Abbrev("NOLOAD",op,3)     Then  load = 0                          
  890.         When  Abbrev("SCREEN",op,3)     Then  fsin = 1                          
  891.         When  Abbrev("LOAD",op,1)       Then  load = 1                          
  892.         Otherwise 'XMITMSG 3 OP (ERRMSG'                                        
  893.         End  Select  /*  op  */                                                 
  894.     End  /*  Do  While  */                                                      
  895.                                                                                 
  896. 'SET LANGUAGE (ADD GOP USER'                                                    
  897. If rc ^= 0 Then Exit rc                                                         
  898.                                                                                 
  899. /*  fetch the program ID string  */                                             
  900. 'PIPE COMMAND XMITMSG 0 (APPLID GOP CALLER CLI NOHEADER | VAR PROGID'           
  901.                                                                                 
  902. /*  migrate old bookmarks  */                                                   
  903. 'EXEC GOPHMARK'                                                                 
  904.                                                                                 
  905. Parse Upper Arg tube . '(' . ')' .                                              
  906.                                                                                 
  907. 'GLOBALV SELECT GOPHER PUT GOPHER PROGID TUBE'                                  
  908. 'GLOBALV SELECT GOPHER SET ITEM'                                                
  909. 'GLOBALV SELECT GOPHER SET COMMAND'                                             
  910.                                                                                 
  911. /*  initialize screen variables  */                                             
  912. If fsin Then Do                                                                 
  913.     If ^Datatype(tube,'X') Then 'VMFCLEAR'      /*  clear if cons  */           
  914.     Call FSINIT tube            /*  figure out some screen attribs  */          
  915.     'PIPE REXXVARS | DROP | JOIN 1 /,/ | LOCATE /n FS./' ,                      
  916.             '| CHANGE /n /GLOBALV SELECT GOPHER SETL / 1' ,                     
  917.                     '| CHANGE /,v / / 1 | COMMAND'                              
  918.     End  /*  If  ..  Do  */                                                     
  919.                                                                                 
  920. /*  load client gems into memory for efficiency  */                             
  921. If load Then                                                                    
  922. 'PIPE CMS L GOPCLI* REXX * | SPEC /EXECLOAD / 1 1-* NEXT | COMMAND'             
  923.                                                                                 
  924. Exit                                                                            
  925.                                                                                 
  926.                                                                                 
  927.                                                                                 
  928. /* -------------------------------------------------------------- FSINIT        
  929.  * Initialize variables used in building screen displays.                       
  930.  * (this code comes from Chuck Boeheim's PIPEDEMO; Thanks, Chuck!)              
  931.  */                                                                             
  932. FSINIT:   Procedure Expose fs.                                                  
  933. Parse Arg t                                                                     
  934. fs.tube = t                                                                     
  935.                                                                                 
  936. If Datatype(fs.tube,'X') Then Do                                                
  937.                                                                                 
  938.     /*----------------------------------------------------------------*/        
  939.     /*  a dialed 3270 with pessimistic assumptions                    */        
  940.     /*----------------------------------------------------------------*/        
  941.                                                                                 
  942.     fs.scrrows = 24                                                             
  943.     fs.scrcols = 80                                                             
  944.     fs.write  = '80'x                                                           
  945.     flags = '00'x                                                               
  946.                                                                                 
  947.     End  /*  If  ..  Do  */                                                     
  948.                                                                                 
  949. Else Do                                                                         
  950.                                                                                 
  951.     /*----------------------------------------------------------------*/        
  952.     /*  Get the screen size from CP.                                  */        
  953.     /*----------------------------------------------------------------*/        
  954.                                                                                 
  955.     Parse Value Diag('8C') with flags +1 3 fs.scrcols +2 fs.scrrows +2 .        
  956.     fs.scrrows = c2d(fs.scrrows)                                                
  957.     fs.scrcols = c2d(fs.scrcols)                                                
  958.                                                                                 
  959.     If  fs.scrrows > 24 | fs.scrcols > 80   Then fs.write = 'C0'x               
  960.                                             Else fs.write = '80'x               
  961.                                                                                 
  962.     End  /*  Else  Do  */                                                       
  963.                                                                                 
  964. fs.operwa = 'C0'x       /* Erase/Write alternate      */                        
  965. fs.operw  = '80'x       /* Erase/Write                */                        
  966. fs.opwr   = '00'x       /* Write                      */                        
  967. fs.oprd   = '06'x       /* Read modified.             */                        
  968.                                                                                 
  969. fs.wcc    = '03'x       /* Unlock keyboard, reset mdt */                        
  970.                                                                                 
  971. fs.high   = '1DE8'x     /* Protected, highlighted.    */                        
  972. fs.low    = '1D60'x     /* Protected, normal.         */                        
  973. fs.ic     = '13'x       /* Insert cursor.             */                        
  974.                                                                                 
  975. fs.color = (bitand(flags,'80'x) = '80'x)                                        
  976. fs.exthi = (bitand(flags,'40'x) = '40'x)                                        
  977. fs.pss   = (bitand(flags,'20'x) = '20'x)                                        
  978. fs.7171  = (bitand(flags,'02'x) = '02'x)                                        
  979. fs.14bit = (bitand(flags,'01'x) = '01'x)                                        
  980.                                                                                 
  981. Return                                                                          
  982.                                                                                 
  983.                                                                                 
  984.                                                                                 
  985. /* -------------------------------------------------------------- UNLOAD        
  986.  *  Unload Gopher EXECs, pipeline stages, messages to free-up memory.           
  987.  */                                                                             
  988. UNLOAD:                                                                         
  989.                                                                                 
  990. 'PIPE COMMAND EXECMAP | LOCATE 1.3 /GOP/' ,                                     
  991.         '| SPEC /EXECDROP / 1 1.20 NEXT | COMMAND'                              
  992. If rc ^= 0 Then Exit rc                                                         
  993.                                                                                 
  994. 'SET LANGUAGE (DELETE GOP USER'                                                 
  995.                                                                                 
  996. If rc ^= 0 Then Exit rc                                                         
  997.                                                                                 
  998. Exit                                                                            
  999.                                                                                 
  1000. :READ  GOPCLISX REXX     A1 TMP200 01/24/93 23:28:05                            
  1001. /*                                                                              
  1002.  *        Name: GOPCLISX REXX                                                   
  1003.  *              CMS Gopher client TCP/IP (sockets; "sox") function              
  1004.  *      Author: Rick Troth, Rice University, Information Systems                
  1005.  *        Date: 1992-Dec-23                                                     
  1006.  *                                                                              
  1007.  *       Input: one or more gopher menu lines                                   
  1008.  *    Output 0: zero or more blocks of raw (may be ASCII) data                  
  1009.  *    Output 1: status messages and/or error messages                           
  1010.  *                                                                              
  1011.  *        Note: input is "plain text" (EBCDIC),  while output                   
  1012.  *              may be anything.   If output is "plain text" (ASCII),           
  1013.  *              the following stage must handle translation.                    
  1014.  */                                                                             
  1015.                                                                                 
  1016. /*                                                                              
  1017.  *      Copyright 1992 Richard M. Troth.   This software was developed          
  1018.  *      with resources provided by Rice University and is intended              
  1019.  *      to serve Rice's user community.   Rice has benefitted greatly           
  1020.  *      from the free distribution of software,  therefore distribution         
  1021.  *      of unmodified copies of this material is not restricted.                
  1022.  *      You may change your own copy as needed.   Neither Rice                  
  1023.  *      University nor any of its employees or students shall be held           
  1024.  *      liable for damages resulting from the use of this software.             
  1025.  */                                                                             
  1026.                                                                                 
  1027. Trace "OFF"                                                                     
  1028.                                                                                 
  1029. /*  sync with input so that 'CALLPIPE COMMAND' will work  */                    
  1030. 'PEEKTO'                                                                        
  1031.                                                                                 
  1032. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER GET GOPHER'                             
  1033. If gopher = "" Then gopher = "Gopher"                                           
  1034. quit = 0                                                                        
  1035.                                                                                 
  1036. Parse Arg . '(' opts ')' .                                                      
  1037.                                                                                 
  1038. trans = 0                                                                       
  1039. Do While opts ^= ""                                                             
  1040.     Parse Var opts op opts                                                      
  1041.     Upper op                                                                    
  1042.     Select  /*  op  */                                                          
  1043.         When Abbrev("TRANSLATE",op,4) Then trans = 1                            
  1044.         When Abbrev("NOTRANSLATE",op,6) Then trans = 0                          
  1045.         Otherwise Address "COMMAND" 'XMITMSG 3 OP (ERRMSG'                      
  1046.         End  /*  Select  op  */                                                 
  1047.     End  /*  Do  While  */                                                      
  1048.                                                                                 
  1049. If trans Then crlf = '0D25'x                                                    
  1050.          Else crlf = '0D0A'x                                                    
  1051.                                                                                 
  1052. /*                                                                              
  1053.  *   Initialize RXSOCKET                                                        
  1054.  */                                                                             
  1055. maxdesc = Socket('Initialize', gopher)                                          
  1056. If maxdesc = "-1" Then Do                                                       
  1057.     If errno ^= "ESUBTASKALREADYACTIVE" Then Do                                 
  1058.     /*  Call STATUS tcperror()  */                                              
  1059.         Exit -1                                                                 
  1060.         End  /*  If  ..  Do  */                                                 
  1061.     rc = Socket('Terminate')                                                    
  1062.     maxdesc = Socket('Initialize', gopher)                                      
  1063.     If maxdesc = "-1" Then Do                                                   
  1064.         Call STATUS tcperror()                                                  
  1065.         Exit -1                                                                 
  1066.         End  /*  If  ..  Do  */                                                 
  1067.     End  /*  If  ..  Do  */                                                     
  1068.                                                                                 
  1069. /*  L O O P  */                                                                 
  1070.                                                                                 
  1071. Do Forever                                                                      
  1072.                                                                                 
  1073.     'PEEKTO ITEM'                                                               
  1074.     If rc ^= 0 Then Leave                                                       
  1075.                                                                                 
  1076.     Parse Var item 1 type 2 name '05'x path '05'x host ,                        
  1077.                                  '05'x port '05'x xtra                          
  1078.     port = Strip(port)              /*  for robustness  */                      
  1079.     If type = '7' Then path = path || '05'x || xtra                             
  1080.                                                                                 
  1081.     /*  Call STATUS "Connecting ... press ENTER twice to abort"  */             
  1082.     /*  Call STATUS "Connecting to" host "port" port  */                        
  1083.     Call STATUS 22 '"' || host || '"' '"' || port || '"'                        
  1084.                                                                                 
  1085.     /*                                                                          
  1086.      *   Request a new socket descriptor (TCP protocol)                         
  1087.      */                                                                         
  1088.     socket = Socket('Socket', 'AF_INET', 'Sock_Stream')                         
  1089.     If socket = "-1" Then Do                                                    
  1090.         Call STATUS tcperror()                                                  
  1091.         Exit -1                                                                 
  1092.         End  /*  If  ..  Do  */                                                 
  1093.                                                                                 
  1094.     If trans Then Do                                                            
  1095.         /*                                                                      
  1096.          *   Enable ASCII<->EBCDIC Translation Option                           
  1097.          */                                                                     
  1098.         rc = Socket('SetSockOpt', socket, 'SOL_SOCKET', 'SO_EBCDIC', 1)         
  1099.         If rc = "-1" Then Do                                                    
  1100.             Call STATUS tcperror()                                              
  1101.             Exit -1                                                             
  1102.             End  /*  If  ..  Do  */                                             
  1103.         End  /*  If  ..  Do  */                                                 
  1104.                                                                                 
  1105.     /*                                                                          
  1106.      *   Connect to the server                                                  
  1107.      */                                                                         
  1108.     Parse Var host h1 '.' h2 '.' h3 '.' h4 '.' .                                
  1109.     If  Datatype(h1,'N') &,                                                     
  1110.         Datatype(h2,'N') &,                                                     
  1111.         Datatype(h3,'N') &,                                                     
  1112.         Datatype(h4,'N')    Then                                                
  1113.         hisaddr = d2c(h1) || d2c(h2) || d2c(h3) || d2c(h4)                      
  1114.     Else Do                                                                     
  1115.         hisaddr = Socket('GetHostByName', host)                                 
  1116.         If hisaddr = "-1" Then Do                                               
  1117.         Call STATUS tcperror()                                                  
  1118.             Exit -1                                                             
  1119.             End  /*  If  ..  Do  */                                             
  1120.         End  /*  Else  Do  */                                                   
  1121.                                                                                 
  1122.     /*  Parse Var hisaddr h1 +1 h2 +1 h3 +1 h4 +1 .  */                         
  1123.                                                                                 
  1124.     name = AF_INET || Htons(port) || hisaddr                                    
  1125.                                                                                 
  1126.     /*                                                                          
  1127.      *   Set this socket to non-blocking mode                                   
  1128.      */                                                                         
  1129.     rc = Socket('Ioctl', socket, 'FIONBIO', 1)                                  
  1130.     If rc="-1" Then Do                                                          
  1131.         Call STATUS tcperror()                                                  
  1132.         Exit -1                                                                 
  1133.         End  /*  If  ..  Do  */                                                 
  1134.                                                                                 
  1135.     /*                                                                          
  1136.      *   Connect to the host                                                    
  1137.      */                                                                         
  1138.     rc = Socket('Connect', socket, name)                                        
  1139.     If rc = "-1" Then ,                                                         
  1140.         If errno ^= "EINPROGRESS" Then Do                                       
  1141.             Call STATUS tcperror()                                              
  1142.             If errno = "ECONNREFUSED" Then ,                                    
  1143.                 Call STATUS 23 '"' || host || '"' '"' || port || '"'            
  1144.         Exit -1                                                                 
  1145.         End  /*  If  ..  Do  */                                                 
  1146.                                                                                 
  1147.     rc = FD_ZERO('readmask')                                                    
  1148.     rc = FD_ZERO('writemask')                                                   
  1149.     rc = FD_SET(socket,'writemask')                                             
  1150.     rc = FD_SET('0', 'readmask')                                                
  1151.                                                                                 
  1152.     rc = Socket('Select', socket+1, 'readmask', 'writemask', 0, 20)             
  1153.     If rc="-1" Then Do                                                          
  1154.         Call STATUS tcperror()                                                  
  1155.         Exit -1                                                                 
  1156.         End  /*  If  ..  Do  */                                                 
  1157.                                                                                 
  1158.     If FD_ISSET('0', 'readmask')<>0 Then Do                                     
  1159.         rc = Socket('Close', socket)                                            
  1160.         /*  Call STATUS "Connection canceled by user request"  */               
  1161.         Call STATUS 28                                                          
  1162.         Exit -1                                                                 
  1163.         End                                                                     
  1164.                                                                                 
  1165.     If FD_ISSET(socket, 'writemask')=0 Then Do                                  
  1166.         rc = Socket('Close', socket)                                            
  1167.         /*  Call STATUS "Connection canceled by TIMEOUT"  */                    
  1168.         Call STATUS 29                                                          
  1169.         Exit -1                                                                 
  1170.         end                                                                     
  1171.                                                                                 
  1172.     /* Return to standard mode                                                  
  1173.     rc = Socket('Ioctl', socket, 'FIONBIO', 0)                                  
  1174.      */                                                                         
  1175.                                                                                 
  1176.     /*  TRANSlate option will affect both writing to,  as well as     *         
  1177.      *  reading from,  the socket.   So if the socket is set for      *         
  1178.      *  TRANSLATE,  then we need not translate the path from EBCDIC   *         
  1179.      *  to ASCII.   But if not,  then we must do so as follows:       */        
  1180.     If ^trans Then                                                              
  1181.     'CALLPIPE VAR PATH | TCPE2A' gopher '| VAR PATH'                            
  1182.                                                                                 
  1183.     /*                                                                          
  1184.      *   Send the "query" to the server                                         
  1185.      */                                                                         
  1186.     bytes_out = Socket('Write', socket, path || crlf)                           
  1187.     If bytes_out = "-1" Then Do                                                 
  1188.         If errno = 'EPIPE' Then ,                                               
  1189.             'OUTPUT' "ECONNREFUSED"                                             
  1190.         If errno = 'EPIPE' Then ,                                               
  1191.             Call STATUS 23 '"' || host || '"' '"' || port || '"'                
  1192.         Else Call STATUS tcperror()                                             
  1193.         Exit -1                                                                 
  1194.         End  /*  If  ..  Do  */                                                 
  1195.                                                                                 
  1196.     /*  Call STATUS "Reading ... press ENTER twice to abort"  */                
  1197.     /*  Call STATUS "Reading ... "  */                                          
  1198.     /*  Call STATUS 24  */                                                      
  1199.                                                                                 
  1200.     totbytes = 0                                                                
  1201. prevtot = 0                                                                     
  1202.     /*                                                                          
  1203.      *   Loop, reading response and sending to the next pipeline stage          
  1204.      */                                                                         
  1205.     Do Forever                                                                  
  1206.         /* Set up to trap console ENTER key */                                  
  1207.         rc = FD_ZERO('readmask')                                                
  1208.         rc = FD_SET('0','readmask')                                             
  1209.         rc = FD_SET(socket,'readmask')                                          
  1210.                                                                                 
  1211.         /* Wait for something to happen */                                      
  1212.         rc = Socket('Select',socket+1,'readmask',0,0)                           
  1213.         /* If console input, clear 'socket' and return */                       
  1214.         If FD_ISSET('0','readmask')<>0 Then Do                                  
  1215.             /*  Call STATUS "Request ABORTED"  */                               
  1216.             Call STATUS 27                                                      
  1217.             rc = Socket('Close', socket)                                        
  1218.             Leave                                                               
  1219.             End                                                                 
  1220.                                                                                 
  1221.         bytes_in = Socket('Read', socket, 'pack')                               
  1222.         If bytes_in = "-1" Then                                                 
  1223.             Call STATUS tcperror()                                              
  1224.         If bytes_in < 1 Then Leave                                              
  1225.                                                                                 
  1226.         totbytes = totbytes + bytes_in                                          
  1227. If prevtot/totbytes < 0.9 Then  /* adjust the 0.9 factor to taste */            
  1228. Do                                                                              
  1229.         Call STATUS 26 '"' || totbytes || '"'                                   
  1230. prevtot = totbytes                                                              
  1231. End                                                                             
  1232.         'OUTPUT' pack                                                           
  1233.         If rc ^= 0 Then Leave                                                   
  1234.                                                                                 
  1235.         End  /*  Do  Forever  */                                                
  1236.                                                                                 
  1237.     If rc ^= 0 Then Leave                                                       
  1238.                                                                                 
  1239.     /*                                                                          
  1240.      *   All done, relinquish our socket descriptor                             
  1241.      */                                                                         
  1242.     rc = Socket('Close', socket)                                                
  1243.     If rc = "-1" Then Do                                                        
  1244.         Call STATUS tcperror()                                                  
  1245.         Leave                                                                   
  1246.         End  /*  If  ..  Do  */                                                 
  1247.                                                                                 
  1248.     'READTO'                                                                    
  1249.                                                                                 
  1250.     End  /*  Do  Forever  */                                                    
  1251.                                                                                 
  1252. /*                                                                              
  1253.  *   Tell RXSOCKET that we are done with this IUCV path                         
  1254.  */                                                                             
  1255. rc = Socket('Terminate')                                                        
  1256. If rc = "-1" Then Do                                                            
  1257.     Call STATUS tcperror()                                                      
  1258.     Exit -1                                                                     
  1259.     End                                                                         
  1260.                                                                                 
  1261. /*  an empty line as last in status stream indicates success  */                
  1262. /*  Call STATUS " "  */                                                         
  1263.                                                                                 
  1264. Exit                                                                            
  1265.                                                                                 
  1266.                                                                                 
  1267.                                                                                 
  1268. /* -------------------------------------------------------------- STATUS        
  1269.  * Write  "status messages"  to the secondary stream,  if connected.            
  1270.  * This routine saves & restores the current stream selection.                  
  1271.  * (though there are presently no other streams used besides 1 and 0)           
  1272.  */                                                                             
  1273. STATUS:   Procedure                                                             
  1274. Parse Arg string                                                                
  1275.                                                                                 
  1276. /* note the current stream (should be zero) */                                  
  1277. 'STREAMNO OUTPUT'                                                               
  1278. If rc < 0 Then Return                                                           
  1279. stream = rc                                                                     
  1280.                                                                                 
  1281. /* select secondary stream and output the string */                             
  1282. 'SELECT OUTPUT 1'                                                               
  1283. If rc ^= 0 Then Return                                                          
  1284. If Datatype(Word(string,1),'N') Then                                            
  1285. 'CALLPIPE COMMAND XMITMSG' string '(APPLID GOP CALLER TCP ERRMSG | *:'          
  1286. Else 'OUTPUT' string                                                            
  1287. 'SELECT OUTPUT' stream                                                          
  1288.                                                                                 
  1289. Return                                                                          
  1290.                                                                                 
  1291. :READ  GOPCLITM REXX     A1 TMP200 01/25/93 00:44:11                            
  1292. /*                                                                              
  1293.  *        Name: GOPCLITM REXX                                                   
  1294.  *              VM TCP/IP Network GOPHER Client item processor                  
  1295.  *      Author: Rick Troth, Rice University, Information Systems                
  1296.  *        Date: 1992-Dec-23                                                     
  1297.  *                                                                              
  1298.  *       Input: one or more gopher menu lines                                   
  1299.  *      Output: zero or more information or error messages                      
  1300.  *              (EOF does not propagate back to input)                          
  1301.  */                                                                             
  1302.                                                                                 
  1303. /*                                                                              
  1304.  *      Copyright 1992 Richard M. Troth.   This software was developed          
  1305.  *      with resources provided by Rice University and is intended              
  1306.  *      to serve Rice's user community.   Rice has benefitted greatly           
  1307.  *      from the free distribution of software,  therefore distribution         
  1308.  *      of unmodified copies of this material is not restricted.                
  1309.  *      You may change your own copy as needed.   Neither Rice                  
  1310.  *      University nor any of its employees or students shall be held           
  1311.  *      liable for damages resulting from the use of this software.             
  1312.  */                                                                             
  1313.                                                                                 
  1314. Trace "OFF"                                                                     
  1315.                                                                                 
  1316. Parse Upper Arg disp . '(' . ')' .                                              
  1317. If disp = "" Then disp = "OPEN"                                                 
  1318. /*  Say open  */                                                                
  1319.                                                                                 
  1320. /*  sync with input so that 'CALLPIPE COMMAND' will work  */                    
  1321. 'PEEKTO'                                                                        
  1322.                                                                                 
  1323. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER GET GOPHER PROGID'                      
  1324.                                                                                 
  1325. /*  fetch fs. stem variable from GlobalVs  */                                   
  1326. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER LIST | DROP' ,                          
  1327.         '| LOCATE 1-4 / FS./ | SPEC /=/ 1 2-* NEXT | VARLOAD'                   
  1328. If ^Datatype(fs.tube,'X') Then fs.tube = ""                                     
  1329.                                                                                 
  1330. /*  prepare for dynamic connection statistics  */                               
  1331. stat = 'STEM STAT. | GOPCLIST'                                                  
  1332.                                                                                 
  1333. Do Forever                                                                      
  1334.                                                                                 
  1335.     'PEEKTO ITEM'                                                               
  1336.     If rc ^= 0 Then Leave                                                       
  1337.                                                                                 
  1338.     'CALLPIPE COMMAND GLOBALV SELECT GOPHER PUT ITEM'                           
  1339.                                                                                 
  1340.     Parse Var item name '05'x path '05'x host '05'x port '05'x xtra             
  1341.     Parse Var name 1 type 2 name                                                
  1342.                                                                                 
  1343. stat.0 = 0                                                                      
  1344.                                                                                 
  1345.     Select  /*  type  */                                                        
  1346.                                                                                 
  1347.         When  type = '0'  Then  Call  OPENFILE                                  
  1348.                                                                                 
  1349.         When  type = '1'  Then  Call  OPENMENU                                  
  1350.                                                                                 
  1351.         When  type = '2'  Then  Call  LOOKUP                                    
  1352.                                                                                 
  1353.         When  type = '4'  Then  Call  OPENFILE  /* MAC */                       
  1354.                                                                                 
  1355.         When  type = '5'  Then  Call  OPENFILE  /* DOS */                       
  1356.                                                                                 
  1357.         When  type = '6'  Then  Call  OPENFILE  /* UUE */                       
  1358.                                                                                 
  1359.         When  type = '7'  Then  Call  SEARCH                                    
  1360.                                                                                 
  1361.         When  type = '8'  Then  Call  TELNET                                    
  1362.                                                                                 
  1363.         When  type = '9'  Then  Call  BINARY                                    
  1364.                                                                                 
  1365.         When  type = 'T'  Then  Call  TN3270                                    
  1366.                                                                                 
  1367.         When  type = 'r'  | ,                                                   
  1368.               type = 'v'  Then  Call  CMSBLOCK                                  
  1369.                                                                                 
  1370.         When  type = 'I'  | ,                                                   
  1371.               type = ':'  | ,                                                   
  1372.               type = 'g'  Then  Call  GRAPHICS                                  
  1373.                                                                                 
  1374.         Otherwise               Call  OPENFILE                                  
  1375.                                                                                 
  1376.         End  /*  Select  type  */                                               
  1377.                                                                                 
  1378. If rc ^= 0 Then 'CALLPIPE STEM STAT. | *:'                                      
  1379.                                                                                 
  1380.     'READTO'                                                                    
  1381.                                                                                 
  1382.     End  /*  Do  Forever  */                                                    
  1383.                                                                                 
  1384. Exit rc * (rc ^= 12)                                                            
  1385.                                                                                 
  1386.                                                                                 
  1387.                                                                                 
  1388. /* ------------------------------------------------------------ OPENFILE        
  1389.  *  View or retrieve a plain text file.                                         
  1390.  */                                                                             
  1391. OPENFILE:                                                                       
  1392.                                                                                 
  1393. filter = 'GOPCLITX'                                                             
  1394.                                                                                 
  1395. If disp = "KEEP" Then Signal KEEPFILE                                           
  1396.                                                                                 
  1397. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                                     
  1398.     '| GOPCLITX | GOPCLIFV | *:' ,                                              
  1399.     '! E: |' stat                                                               
  1400.                                                                                 
  1401. Return                                                                          
  1402.                                                                                 
  1403.                                                                                 
  1404.                                                                                 
  1405. /* ------------------------------------------------------------ OPENMENU        
  1406.  *  View or retrieve a plain text file.                                         
  1407.  */                                                                             
  1408. OPENMENU:                                                                       
  1409.                                                                                 
  1410. filter = 'GOPCLITX'                                                             
  1411.                                                                                 
  1412. If disp = "KEEP" Then Signal KEEPFILE                                           
  1413.                                                                                 
  1414. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                                     
  1415.     '| GOPCLITX | GOPCLIMB | *:' ,                                              
  1416.     '! E: |' stat                                                               
  1417.                                                                                 
  1418. Return                                                                          
  1419.                                                                                 
  1420.                                                                                 
  1421.                                                                                 
  1422. /* -------------------------------------------------------------- LOOKUP        
  1423.  *  Perform user lookup.   (punt to PH EXEC or equivalent)                      
  1424.  */                                                                             
  1425. LOOKUP:                                                                         
  1426.                                                                                 
  1427. host = Strip(host)                                                              
  1428. port = Strip(port)                                                              
  1429. 'CALLPIPE COMMAND GLOBALV SELECT PHCMS PUT HOST PORT'                           
  1430. Address "CMS" 'PH'                                                              
  1431.                                                                                 
  1432. Return                                                                          
  1433.                                                                                 
  1434.                                                                                 
  1435.                                                                                 
  1436. /* -------------------------------------------------------------- SEARCH        
  1437.  */                                                                             
  1438. SEARCH:                                                                         
  1439.                                                                                 
  1440. 'CALLPIPE COMMAND XMITMSG 601 (APPLID GOP NOHEADER' ,                           
  1441.         '| GOPCLIUI | VAR KEYWORDS'                                             
  1442. keywords = Strip(keywords)                                                      
  1443. If keywords = "" Then Return                                                    
  1444.                                                                                 
  1445. /*  prepend a  path<TAB>  to search string for WAIS servers  */                 
  1446. /*  path = path || '05'x || keywords  */                                        
  1447. item = item || '05'x || keywords                                                
  1448.                                                                                 
  1449. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                                     
  1450.     '| GOPCLITX | GOPCLIMB | *:'                                                
  1451.     '! E: |' stat                                                               
  1452.                                                                                 
  1453. Return                                                                          
  1454.                                                                                 
  1455.                                                                                 
  1456.                                                                                 
  1457. /* -------------------------------------------------------------- TELNET        
  1458.  */                                                                             
  1459. TELNET:                                                                         
  1460.                                                                                 
  1461. If fs.tube ^= "" Then Do                                                        
  1462.     /*  'OUTPUT' "Can't TELNET from this screen"  */                            
  1463.     'CALLPIPE COMMAND XMITMSG 512 "TELNET"' ,                                   
  1464.             '(APPLID GOP CALLER CLI ERRMSG | *:'                                
  1465.     Return                                                                      
  1466.     End /* If .. Do */                                                          
  1467.                                                                                 
  1468. Address "COMMAND"                                                               
  1469.                                                                                 
  1470. 'VMFCLEAR'                                                                      
  1471. If port = 0 Then port = ""                                                      
  1472. /*  Say progid "TELNET" host port  */                                           
  1473. 'XMITMSG 30 HOST PORT (APPLID GOP CALLER CLI ERRMSG'                            
  1474. /*  Say name  */                                                                
  1475. 'XMITMSG 7 NAME (APPLID GOP CALLER CLI ERRMSG NOCOMP'                           
  1476.                                                                                 
  1477. If path ^= "" Then Do                                                           
  1478.     /*  Say "login with:" path  */                                              
  1479.     'XMITMSG 32 PATH (APPLID GOP CALLER CLI NOHEADER'                           
  1480.     /*  Say "Press ENTER to continue ... "  */                                  
  1481.     'XMITMSG 33 (APPLID GOP CALLER CLI NOHEADER'                                
  1482.     Parse External                                                              
  1483.     End  /*  If  ..  Do  */                                                     
  1484.                                                                                 
  1485. 'GLOBALV SELECT GOPHER GET TELNET'                                              
  1486. If telnet = "" Then telnet = "TELNET"                                           
  1487. Address "CMS" telnet host port                                                  
  1488. 'VMFCLEAR'                                                                      
  1489.                                                                                 
  1490. Address                                                                         
  1491.                                                                                 
  1492. Return                                                                          
  1493.                                                                                 
  1494.                                                                                 
  1495.                                                                                 
  1496. /* -------------------------------------------------------------- BINARY        
  1497.  *  Load a "binary" (byte stream) file onto disk.                               
  1498.  */                                                                             
  1499. BINARY:                                                                         
  1500.                                                                                 
  1501. filter = ""                                                                     
  1502.                                                                                 
  1503. If disp = "KEEP" Then Signal KEEPFILE                                           
  1504.                                                                                 
  1505. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                                     
  1506.     '| GOPCLIFV | *:' ,                                                         
  1507.     '! E: |' stat                                                               
  1508.                                                                                 
  1509. Return                                                                          
  1510.                                                                                 
  1511.                                                                                 
  1512.                                                                                 
  1513. /* -------------------------------------------------------------- TN3270        
  1514.  *  This is almost exactly the same as the  TELNET  routine,                    
  1515.  *  but we let the user run a different program,  specified in                  
  1516.  *  global variable  TN3270,  if they wish.                                     
  1517.  */                                                                             
  1518. TN3270:                                                                         
  1519.                                                                                 
  1520. If fs.tube ^= "" Then Do                                                        
  1521.     /*  'OUTPUT' "Can't TN3270 from this screen"  */                            
  1522.     'CALLPIPE COMMAND XMITMSG 512 "TN3270"' ,                                   
  1523.             '(APPLID GOP CALLER CLI ERRMSG | *:'                                
  1524.     Return                                                                      
  1525.     End /* If .. Do */                                                          
  1526.                                                                                 
  1527. Address "COMMAND"                                                               
  1528.                                                                                 
  1529. 'VMFCLEAR'                                                                      
  1530. If port = 0 Then port = ""                                                      
  1531. /*  Say progid "TN3270" host port  */                                           
  1532. 'XMITMSG 31 HOST PORT (APPLID GOP CALLER CLI ERRMSG'                            
  1533. /*  Say name  */                                                                
  1534. 'XMITMSG 7 NAME (APPLID GOP CALLER CLI ERRMSG NOCOMP'                           
  1535. If path ^= "" Then Do                                                           
  1536.     /*  Say "login with:" path  */                                              
  1537.     'XMITMSG 32 PATH (APPLID GOP CALLER CLI NOHEADER'                           
  1538.     /*  Say "Press ENTER to continue ... "  */                                  
  1539.     'XMITMSG 33 (APPLID GOP CALLER CLI NOHEADER'                                
  1540.     Parse External                                                              
  1541.     End  /*  If  ..  Do  */                                                     
  1542.                                                                                 
  1543. 'GLOBALV SELECT GOPHER GET TN3270'                                              
  1544. If tn3270 = "" Then Do                                                          
  1545.     'GLOBALV SELECT GOPHER GET TELNET'                                          
  1546.     If telnet = "" Then telnet = "TELNET"                                       
  1547.     tn3270 = telnet                                                             
  1548.     End  /*  If  ..  Do  */                                                     
  1549. Address "CMS" tn3270 host port                                                  
  1550. 'VMFCLEAR'                                                                      
  1551.                                                                                 
  1552. Address                                                                         
  1553.                                                                                 
  1554. Return                                                                          
  1555.                                                                                 
  1556.                                                                                 
  1557.                                                                                 
  1558. /* ------------------------------------------------------------ CMSBLOCK        
  1559.  *  Save a record oriented file (type 'r' or type 'v') onto disk.               
  1560.  */                                                                             
  1561. CMSBLOCK:                                                                       
  1562.                                                                                 
  1563. filter = 'DEBLOCK CMS'                                                          
  1564.                                                                                 
  1565. If disp = "KEEP" Then Signal KEEPFILE                                           
  1566.                                                                                 
  1567. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                                     
  1568.     '| DEBLOCK CMS | GOPCLIFV | *:' ,                                           
  1569.     '! E: |' stat                                                               
  1570.                                                                                 
  1571. Return                                                                          
  1572.                                                                                 
  1573.                                                                                 
  1574.                                                                                 
  1575. /* ------------------------------------------------------------ GRAPHICS        
  1576.  *  Display or save a graphics (type 'I') file.                                 
  1577.  */                                                                             
  1578. GRAPHICS:                                                                       
  1579.                                                                                 
  1580. filter = ""     /*  same as for  "binary"  files  */                            
  1581.                                                                                 
  1582. If disp = "KEEP" Then Signal KEEPFILE                                           
  1583.                                                                                 
  1584. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                                     
  1585.         '| GOPCLIGV | *: ! E: |' stat                                           
  1586.                                                                                 
  1587. Return                                                                          
  1588.                                                                                 
  1589.                                                                                 
  1590.                                                                                 
  1591. /* ------------------------------------------------------------ KEEPFILE        
  1592.  *  Save the selected file on disk.                                             
  1593.  */                                                                             
  1594. KEEPFILE:                                                                       
  1595.                                                                                 
  1596. If fs.tube ^= "" Then Do                                                        
  1597.     'CALLPIPE COMMAND XMITMSG 508 (APPLID GOP CALLER CLI ERRMSG | *:'           
  1598.     Return                                                                      
  1599.     End  /*  If  ..  Do  */                                                     
  1600.                                                                                 
  1601. Parse Var path 1 . 2 path    /*  discard type indicator  */                     
  1602. file = gopclifi(path)                                                           
  1603. 'CALLPIPE CMS STATE' file 'A | VAR NOTFOUND'                                    
  1604. If rc ^= 0 & rc ^= 28 Then 'CALLPIPE VAR NOTFOUND | *:'                         
  1605. If rc = 0 Then 'CALLPIPE COMMAND XMITMSG 594 FILE' ,                            
  1606.         '(APPLID GOP CALLER CLI ERRMSG | *:'                                    
  1607. If rc ^= 28 Then Return                                                         
  1608.                                                                                 
  1609. If filter = "" Then                                                             
  1610. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                                     
  1611.         '| >' file 'A' ,                                                        
  1612.         '! E: |' stat                                                           
  1613. Else                                                                            
  1614. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                                     
  1615.         '|' filter '| >' file 'A' ,                                             
  1616.         '! E: |' stat                                                           
  1617.                                                                                 
  1618. If rc = 0 Then 'CALLPIPE COMMAND XMITMSG 571 FILE PATH' ,                       
  1619.         '(APPLID GOP CALLER CLI ERRMSG | *:'                                    
  1620. /*  If rc = 0 Then errmsg = "Created" fn ft fm "from" path  */                  
  1621.                                                                                 
  1622. Return                                                                          
  1623.                                                                                 
  1624. :READ  GOPCLIST REXX     A1 TMP200 01/22/93 12:07:00                            
  1625. /*                                                                              
  1626.  *        Name: GOPCLIST REXX                                                   
  1627.  *              VM TCP/IP Network GOPHER Client transaction status              
  1628.  *      Author: Rick Troth, Rice University, Information Systems                
  1629.  *        Date: 1993-Jan-12                                                     
  1630.  *                                                                              
  1631.  *       Input: zero or more connection status messages                         
  1632.  *      Output: -none-                                                          
  1633.  */                                                                             
  1634.                                                                                 
  1635. /*                                                                              
  1636.  *      Copyright 1992 Richard M. Troth.   This software was developed          
  1637.  *      with resources provided by Rice University and is intended              
  1638.  *      to serve Rice's user community.   Rice has benefitted greatly           
  1639.  *      from the free distribution of software,  therefore distribution         
  1640.  *      of unmodified copies of this material is not restricted.                
  1641.  *      You may change your own copy as needed.   Neither Rice                  
  1642.  *      University nor any of its employees or students shall be held           
  1643.  *      liable for damages resulting from the use of this software.             
  1644.  */                                                                             
  1645.                                                                                 
  1646. Trace "OFF"                                                                     
  1647.                                                                                 
  1648. /*  sync with input  */                                                         
  1649. 'PEEKTO'                                                                        
  1650. If rc ^= 0 Then Exit rc * (rc ^= 12)                                            
  1651.                                                                                 
  1652. /*  abort if we're not in a 370 mode machine  */                                
  1653. Parse Value Diag(08,'QUERY SET') With . "MACHINE" mach . ',' . '15'x .          
  1654. If mach ^= "370" & mach ^= "" Then Do                                           
  1655.     'CALLPIPE *: | HOLE'                                                        
  1656.     Exit rc                                                                     
  1657.     End  /*  If  ..  Do  */                                                     
  1658.                                                                                 
  1659. /*  fetch fs. stem variable from GlobalVs  */                                   
  1660. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER LIST | DROP' ,                          
  1661.         '| LOCATE 1-4 / FS./ | SPEC /=/ 1 2-* NEXT | VARLOAD'                   
  1662. If ^Datatype(fs.tube,'X') Then fs.tube = ""                                     
  1663.                                                                                 
  1664. /*  prepare for dynamic connection statistics  */                               
  1665. _wid = fs.scrcols - 2                                                           
  1666. _sba = c2x(sba(1,-1) || '1D60'x)                                                
  1667.                                                                                 
  1668. 'CALLPIPE *: | CHOP ' _wid '| PAD' _wid ,                                       
  1669.        '| SPEC /00C3' || _sba || '/ X2C 1 1-* NEXT' ,                           
  1670.        '| FULLSCR' fs.tube 'NOREAD | HOLE'                                      
  1671.                                                                                 
  1672. Exit rc                                                                         
  1673.                                                                                 
  1674.                                                                                 
  1675.                                                                                 
  1676. /* ----------------------------------------------------------------- SBA        
  1677.  *  (a better SBA function extracted from PIPEDEMO; thanks, Chuck!)             
  1678.  *  Construct Set Buffer Address order from row and column.                     
  1679.  */                                                                             
  1680.                                                                                 
  1681. SBA:      Procedure Expose fs.                                                  
  1682.                                                                                 
  1683. arg row , col, .                                                                
  1684. row = Trunc(row)                                                                
  1685. col = Trunc(col)                                                                
  1686.                                                                                 
  1687. /*-----------------------------------------------------------------*/           
  1688. /* Calculate binary address.                                       */           
  1689. /*-----------------------------------------------------------------*/           
  1690.                                                                                 
  1691. offset = row * fs.scrcols + col                                                 
  1692. Do While offset < 0; offset = offset + fs.scrrows * fs.scrcols; End             
  1693.                                                                                 
  1694. if fs.14bit then return '11'x || d2c(offset,2)                                  
  1695.                                                                                 
  1696. /*-----------------------------------------------------------------*/           
  1697. /* Convert to six-bit format. (xxxx111111111111 -> 0011111100111111*/           
  1698. /*-----------------------------------------------------------------*/           
  1699.                                                                                 
  1700. 'CALLPIPE var offset'               ,   /* Start with char number.    */        
  1701.     '| spec 1-* d2c 1.2 right'      ,   /* Convert to binary.         */        
  1702.     '| spec 1-* c2b 1'              ,   /* Convert to bit string.     */        
  1703.     '| spec /00/ 1  5.6  3'         ,   /* Place first six bits.      */        
  1704.            '/00/ 9 11.6 11'         ,   /* Place second six bits.     */        
  1705.     '| spec 1-* b2c 1'              ,   /* Convert back to binary.    */        
  1706.     '| xlate *-* 00-3F 40-7F'       ,   /* Translate to coded         */        
  1707.                 '01-09 C1-C9'       ,   /*   buffer address.          */        
  1708.                 '11-19 D1-D9'       ,   /*                            */        
  1709.                 '22-29 E2-E9'       ,   /*                            */        
  1710.                 '30-39 F0-F9'       ,   /*                            */        
  1711.     '| spec x11 1 1.2 2'            ,   /* Prefix with SBA order.     */        
  1712.     '| var offset'                      /* Put back in variable.      */        
  1713.                                                                                 
  1714. Return offset                                                                   
  1715.                                                                                 
  1716. :READ  GOPCLIMB REXX     A1 TMP200 01/25/93 00:34:18                            
  1717. /*                                                                              
  1718.  *        Name: GOPCLIMB REXX                                                   
  1719.  *              VM TCP/IP Network GOPHER Client menu browser                    
  1720.  *      Author: Rick Troth, Rice University, Information Systems                
  1721.  *        Date: 1992-Dec-23                                                     
  1722.  *                                                                              
  1723.  *       Input: one or more gopher menu lines                                   
  1724.  *      Output: zero or more information or error messages                      
  1725.  */                                                                             
  1726.                                                                                 
  1727. /*                                                                              
  1728.  *      Copyright 1992 Richard M. Troth.   This software was developed          
  1729.  *      with resources provided by Rice University and is intended              
  1730.  *      to serve Rice's user community.   Rice has benefitted greatly           
  1731.  *      from the free distribution of software,  therefore distribution         
  1732.  *      of unmodified copies of this material is not restricted.                
  1733.  *      You may change your own copy as needed.   Neither Rice                  
  1734.  *      University nor any of its employees or students shall be held           
  1735.  *      liable for damages resulting from the use of this software.             
  1736.  */                                                                             
  1737.                                                                                 
  1738. Trace "OFF"                                                                     
  1739.                                                                                 
  1740. Parse Arg args '(' . ')' .                                                      
  1741.                                                                                 
  1742. /*  verify availability of input  */                                            
  1743. 'PEEKTO'                                                                        
  1744. If rc ^= 0 & rc ^= 12 Then Exit rc                                              
  1745. If rc = 12 Then Do  /*  empty menu  */                                          
  1746.     'CALLPIPE COMMAND XMITMSG 60 (APPLID GOP CALLER CLI ERRMSG | *:'            
  1747.     Exit                                                                        
  1748.     End  /*  If  ..  Do  */                                                     
  1749.                                                                                 
  1750. Address "COMMAND" 'GLOBALV SELECT GOPHER GET' ,                                 
  1751.         'GOPHER PROGID VIEWER ITEM'                                             
  1752. quit = 0                                                                        
  1753.                                                                                 
  1754. Parse Var item name '05'x path '05'x host '05'x port '05'x xtra                 
  1755. Parse Var name 1 . 2 name       /*  discard type indicator byte  */             
  1756. Parse Var path 1 . 2 path       /*  discard type indicator byte  */             
  1757. If name = "" Then name = args                                                   
  1758. booklist = (item = "")                                                          
  1759.                                                                                 
  1760. /*  fetch fs. stem variable from GlobalVs  */                                   
  1761. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER LIST | DROP' ,                          
  1762.         '| LOCATE 1-4 / FS./ | SPEC /=/ 1 2-* NEXT | VARLOAD'                   
  1763. If ^Datatype(fs.tube,'X') Then fs.tube = ""                                     
  1764.                                                                                 
  1765. 'CALLPIPE *: | STEM MENU.'                                                      
  1766.                                                                                 
  1767. /* is it a server error? */                                                     
  1768. If menu.0 = 1 & Left(menu.1,1) = '-' Then Do                                    
  1769.     Parse Var menu.1 . '-' errmsg '05'x .                                       
  1770.     'OUTPUT' errmsg                                                             
  1771.     Exit                                                                        
  1772.     End  /*  If  ..  Do  */                                                     
  1773.                                                                                 
  1774. /*  display the menu and process user's response  */                            
  1775. row = 0;        col = 0         /*  reset later  */                             
  1776. ki = menu.0;    kl = fs.scrrows - 5;    ko = 1                                  
  1777. needle = ""     /*  may be re-used within this context  */                      
  1778. message.0 = 0                                                                   
  1779. command = ""                                                                    
  1780.                                                                                 
  1781. If booklist Then 'CALLPIPE COMMAND XMITMSG 615' ,                               
  1782.         '(APPLID GOP CALLER CLI NOCOMP | SPEC WORD 2-* 1 | STEM HELP.'          
  1783.             Else 'CALLPIPE COMMAND XMITMSG 613' ,                               
  1784.         '(APPLID GOP CALLER CLI NOCOMP | SPEC WORD 2-* 1 | STEM HELP.'          
  1785.                                                                                 
  1786. 'CALLPIPE COMMAND XMITMSG 5 (APPLID GOP NOHEADER | VAR MORE'                    
  1787.                                                                                 
  1788. Do Forever                                                                      
  1789.                                                                                 
  1790.     /*  write the program title line  */                                        
  1791.     wscreen = sba(0,-1) || field("BLUE","PROT") || sba(0,0) || progid ,         
  1792.                         || sba(0,fs.scrcols-Length(host)-1) || host             
  1793.                                                                                 
  1794.     /*  no SBA for status because it follows host immediately  */               
  1795.     If message.0 < 1 Then Do                                                    
  1796.     wscreen = wscreen   || field("PROT") || Left(ko || '/' || ki, 11)           
  1797.     If ko + kl <= ki Then                                                       
  1798.     wscreen = wscreen   || field("WHITE","HIGH","PROT") || more                 
  1799.         End  /*  If  ..  Do  */                                                 
  1800.                                                                                 
  1801.     /*  don't write status or name if they'll be overlaid  */                   
  1802.     If message.0 < 2 Then                                                       
  1803.     wscreen = wscreen   || sba(2,(fs.scrcols-Length(name))/2) ,                 
  1804.                         || field("WHITE","PROT") || name                        
  1805.                                                                                 
  1806.     /*  write as many message lines as needed  */                               
  1807.     If message.0 > 0 Then Do                                                    
  1808.         Do i = 1 to message.0                                                   
  1809.             wscreen = wscreen || sba(i,-1) ,                                    
  1810.                 || field("RED","HIGH","PROT") || message.i                      
  1811.             End  /*  Do  For  */                                                
  1812.         message.0 = 0                                                           
  1813.         End  /*  If  ..  Do  */                                                 
  1814.     /*  we should probably limit that count  */                                 
  1815.                                                                                 
  1816.     /*  write those PFkey settings  */                                          
  1817.     wscreen = wscreen   || sba(fs.scrrows-2,-1) ,                               
  1818.                         || field("BLUE","PROT") ,                               
  1819.                         || help.1 ,                                             
  1820.                         || sba(fs.scrrows-1,-1) ,                               
  1821.                         || field("BLUE","PROT") ,                               
  1822.                         || help.2                                               
  1823.                                                                                 
  1824.     i = 1; j = ko                                                               
  1825.     Do While i <= kl & j <= ki                                                  
  1826.                                                                                 
  1827.         Parse Var menu.j _name '05'x .                                          
  1828.         Parse Var _name 1 _type 2 _name                                         
  1829.         'CALLPIPE VAR _NAME | XLATE OUTPUT' ,                                   
  1830.             '| XLATE *-* 00-3F 40 FF 40 | VAR _NAME'                            
  1831.                                                                                 
  1832.         wscreen = wscreen || sba(i+2,-1) ,                                      
  1833.                           || field("BLUE","PROT","HIGH")                        
  1834.         If _type = 'i' Then                                                     
  1835.         wscreen = wscreen || Left(_name,fs.scrcols-1)                           
  1836.                       Else Do                                                   
  1837.         wscreen = wscreen || Left(gtag(_type),11) ,                             
  1838.                           || field("GREEN") ,                                   
  1839.                           || Left(_name,fs.scrcols-13)                          
  1840.             If row = 0 Then Do                                                  
  1841.                 row = i + 2;    col = 12                                        
  1842.                 End  /*  If  ..  Do  */                                         
  1843.             End  /*  Else  Do  */                                               
  1844.                                                                                 
  1845.         i = i + 1;  j = j + 1                                                   
  1846.                                                                                 
  1847.         End  /*  Do  While  */                                                  
  1848.                                                                                 
  1849.     rscreen = write_read(wscreen || sba(row,col) || '13'x)                      
  1850.     Parse Var rscreen 1 aid 2 offset . '11'x rscreen                            
  1851.     offset = fix(offset)                                                        
  1852.     row = offset % fs.scrcols; col = offset // fs.scrcols                       
  1853.                                                                                 
  1854.     /*  keep the row/col values within bounds  */                               
  1855.     If  row      <   3       Then row = 3                                       
  1856.     If  row      >   kl + 3  Then row = kl + 3                                  
  1857.     If  row + ko >   ki + 3  Then row = ki + 3 - ko                             
  1858.     col = 12    /*  just reset it  */                                           
  1859.                                                                                 
  1860.     i = row + ko - 3                                                            
  1861.                                                                                 
  1862.     Select /* aid */                                                            
  1863.         When  aid = '7D'x   /* enter */ | ,                                     
  1864.               aid = 'F2'x   /*  PF2  */ | ,                                     
  1865.               aid = 'C2'x   /*  PF14 */ | ,                                     
  1866.               aid = '7B'x   /*  PF11 */ | ,                                     
  1867.               aid = '4B'x   /*  PF23 */ Then  Call  OPEN                        
  1868.         When  aid = 'F3'x   /*  PF3  */ | ,                                     
  1869.               aid = 'C3'x   /*  PF15 */ Then  Leave                             
  1870.         When  aid = 'F4'x   /*  PF4  */ | ,                                     
  1871.               aid = 'C4'x   /*  PF16 */ Then  Call  PRINT                       
  1872.         When  aid = 'F5'x   /*  PF5  */ | ,                                     
  1873.               aid = 'C5'x   /*  PF17 */ Then  Call  KEEP                        
  1874.         When  aid = 'F6'x   /*  PF6  */ | ,                                     
  1875.               aid = 'C6'x   /*  PF18 */ Then  Call  FIND                        
  1876.         When  aid = 'F7'x   /*  PF7  */ | ,                                     
  1877.               aid = 'C7'x   /*  PF19 */ Then Do                                 
  1878.             ko = Max(ko-kl+1,1)                                                 
  1879.             row = 3                                                             
  1880.             End  /*  When  ..  Do  */                                           
  1881.         When  aid = 'F8'x   /*  PF8  */ | ,                                     
  1882.               aid = 'C8'x   /*  PF20 */ Then Do                                 
  1883.             ko = Min(ko+kl-1,ki)                                                
  1884.             row = 3                                                             
  1885.             End  /*  When  ..  Do  */                                           
  1886.         When  aid = 'F9'x   /*  PF9  */ | ,                                     
  1887.               aid = 'C9'x   /*  PF21 */ Then  Call  MARK                        
  1888.         When  aid = '7A'x   /*  PF10 */ | ,                                     
  1889.               aid = '4A'x   /*  PF22 */ Then  Call  BOOKLIST                    
  1890.         When  aid = '6D'x   /* clear */ | ,                                     
  1891.               aid = '6E'x   /*  PA2  */ Then Do                                 
  1892.             row = 3;    col = 12;   ko = 1                                      
  1893.             End  /*  When ..  Do  */                                            
  1894.         When  aid = '7C'x   /*  PF12 */ | ,                                     
  1895.               aid = '4C'x   /*  PF24 */ | ,                                     
  1896.               aid = 'F0'x   /* sysrq */ | ,                                     
  1897.               aid = '6C'x   /*  PA1  */ Then  quit = 1                          
  1898.         When  aid = 'F1'x   /*  PF1  */ | ,                                     
  1899.               aid = 'C1'x   /*  PF13 */ Then  Call  HELP                        
  1900.         When  aid = '00'x               Then Do                                 
  1901.             /*  I/O error on screen  */                                         
  1902.             'CALLPIPE COMMAND XMITMSG 925 (APPLID GOP' ,                        
  1903.                     'CALLER CLI ERRMSG | STEM MESSAGE. APPEND'                  
  1904.             Leave                                                               
  1905.             End                                                                 
  1906.         Otherwise  Do   /*  Undefined PFkey/PAkey  */                           
  1907.             'CALLPIPE COMMAND XMITMSG 657 "' || c2x(aid) || '"' ,               
  1908.                 '(APPLID GOP CALLER CLI ERRMSG | STEM MESSAGE. APPEND'          
  1909.             End  /*  Otherwise  Do  */                                          
  1910.         End  /*  Select  aid  */                                                
  1911.                                                                                 
  1912.     Address "COMMAND" 'GLOBALV SELECT GOPHER GET COMMAND'                       
  1913.     Parse Upper Var command cmdverb .                                           
  1914.     quit = (quit | Abbrev("QUIT",cmdverb,1))                                    
  1915.                                                                                 
  1916.     If quit Then Leave                                                          
  1917.                                                                                 
  1918.     End  /*  Do  Forever  */                                                    
  1919.                                                                                 
  1920. If quit Then command = "QUIT"                                                   
  1921.                                                                                 
  1922. 'CALLPIPE STEM MESSAGE. | *:'                                                   
  1923.                                                                                 
  1924. Parse Upper Var command cmdverb .                                               
  1925. Address "COMMAND" 'GLOBALV SELECT GOPHER PUT' ,                                 
  1926.         'COMMAND CMDVERB'                                                       
  1927.                                                                                 
  1928. Exit                                                                            
  1929.                                                                                 
  1930.                                                                                 
  1931.                                                                                 
  1932. /* ---------------------------------------------------------------- OPEN        
  1933.  */                                                                             
  1934. OPEN:                                                                           
  1935.                                                                                 
  1936. 'CALLPIPE VAR MENU.' || i '| GOPCLITM OPEN | STEM MESSAGE. APPEND'              
  1937.                                                                                 
  1938. Return                                                                          
  1939.                                                                                 
  1940.                                                                                 
  1941.                                                                                 
  1942. /* --------------------------------------------------------------- PRINT        
  1943.  * Print the current "menu" on the user's virtual printer.                      
  1944.  */                                                                             
  1945. PRINT:                                                                          
  1946.                                                                                 
  1947. If fs.tube ^= "" Then Do                                                        
  1948.     /*  "Can't PRINT from this terminal."  */                                   
  1949.     'CALLPIPE COMMAND XMITMSG 507 (APPLID GOP CALLER CLI ERRMSG' ,              
  1950.             '| STEM MESSAGE. APPEND'                                            
  1951.     Return                                                                      
  1952.     End /* If .. Do */                                                          
  1953.                                                                                 
  1954. 'CALLPIPE STEM MENU. | XLATE *-* 05 7A' ,                                       
  1955.         '| PRINT (TITLE' name '| STEM MESSAGE. APPEND'                          
  1956.                                                                                 
  1957. Return                                                                          
  1958.                                                                                 
  1959.                                                                                 
  1960.                                                                                 
  1961. /* ---------------------------------------------------------------- KEEP        
  1962.  */                                                                             
  1963. KEEP:                                                                           
  1964.                                                                                 
  1965. 'CALLPIPE VAR MENU.' || i '| GOPCLITM KEEP | STEM MESSAGE. APPEND'              
  1966.                                                                                 
  1967. Return                                                                          
  1968.                                                                                 
  1969.                                                                                 
  1970.                                                                                 
  1971. /* ---------------------------------------------------------------- FIND        
  1972.  *  Find a particular string within the menu being viewed.                      
  1973.  *  Call GOPCLIUI for user input with prompt.                                   
  1974.  */                                                                             
  1975. FIND:                                                                           
  1976.                                                                                 
  1977. 'CALLPIPE COMMAND XMITMSG 602 "' || needle || '" (APPLID GOP' ,                 
  1978.         'CALLER CLI NOHEADER | GOPCLIUI | VAR NEEDLE'                           
  1979. needle = Translate(Strip(needle))                                               
  1980. If needle = "" Then Return                                                      
  1981.                                                                                 
  1982. Do i = ko + 1 to ki                                                             
  1983.     If Index(Translate(menu.i),needle) > 0 Then Do                              
  1984.         ko = i                                                                  
  1985.         Return                                                                  
  1986.         End  /*  If  ..  Do  */                                                 
  1987.     End  /*  Do  For  */                                                        
  1988.                                                                                 
  1989. /*  'CALLPIPE COMMAND XMITMSG 546 (ERRMSG'  CALLER DMS is OK  */                
  1990. /*  "Target not found"  */                                                      
  1991. 'CALLPIPE COMMAND XMITMSG 546 (APPLID GOP CALLER CLI ERRMSG' ,                  
  1992.         '| STEM MESSAGE. APPEND'                                                
  1993.                                                                                 
  1994. Return                                                                          
  1995.                                                                                 
  1996.                                                                                 
  1997.                                                                                 
  1998. /* ---------------------------------------------------------------- MARK        
  1999.  *  Save a bookmark referencing this menu,                                      
  2000.  *  or  (if in "booklist" mode)  delete the bookmark at the cursor.             
  2001.  */                                                                             
  2002. MARK:                                                                           
  2003.                                                                                 
  2004. If fs.tube ^= "" Then Do                                                        
  2005.     /*  "Can't set bookmarks from this screen."  */                             
  2006.     'CALLPIPE COMMAND XMITMSG 43 (APPLID GOP CALLER CLI ERRMSG' ,               
  2007.             '| STEM MESSAGE. APPEND'                                            
  2008.     Return                                                                      
  2009.     End /* If .. Do */                                                          
  2010.                                                                                 
  2011. If booklist Then Do                                                             
  2012.     'CALLPIPE COMMAND XMITMSG 42 I (APPLID GOP NOHEADER' ,                      
  2013.         '| SPEC /i            / 1 1-* NEXT | VAR BOOKMARK.' || i                
  2014.     If rc = 0 Then                                                              
  2015.     Address "COMMAND" 'GLOBALV SELECT GOPHER PUTP BOOKMARK.' || i               
  2016.     If rc = 0 Then 'CALLPIPE COMMAND XMITMSG 42 I' ,                            
  2017.         '(APPLID GOP CALLER CLI ERRMSG | STEM MESSAGE. APPEND'                  
  2018.         /*  "Bookmark" i "deleted."  */                                         
  2019.     Else 'CALLPIPE COMMAND XMITMSG 514 RC "GLOBALV"' ,                          
  2020.         '(APPLID GOP CALLER CLI ERRMSG | STEM MESSAGE. APPEND'                  
  2021.     Return                                                                      
  2022.     End /* If .. Do */                                                          
  2023.                                                                                 
  2024. Address "COMMAND" 'GLOBALV SELECT GOPHER GET BOOKMARK.0'                        
  2025. If ^Datatype(bookmark.0,'N') Then bookmark.0 = 0                                
  2026. i = bookmark.0 + 1                                                              
  2027. bookmark.i = item                                                               
  2028. Address "COMMAND" 'GLOBALV SELECT GOPHER PUTP BOOKMARK.' || i                   
  2029. bookmark.0 = i                                                                  
  2030. Address "COMMAND" 'GLOBALV SELECT GOPHER PUTP BOOKMARK.0'                       
  2031.                                                                                 
  2032. If rc = 0 Then 'CALLPIPE COMMAND XMITMSG 41 I' ,                                
  2033.     '(APPLID GOP CALLER CLI ERRMSG | STEM MESSAGE. APPEND'                      
  2034.     /*  "Bookmark" i "saved."  */                                               
  2035.           Else 'CALLPIPE COMMAND XMITMSG 514 RC "GLOBALV"' ,                    
  2036.         '(APPLID GOP CALLER CLI ERRMSG | STEM MESSAGE. APPEND'                  
  2037.                                                                                 
  2038. Return                                                                          
  2039.                                                                                 
  2040.                                                                                 
  2041.                                                                                 
  2042. /* ------------------------------------------------------------ BOOKLIST        
  2043.  *  Call GOPCLI to show the lit of bookmarks.                                   
  2044.  */                                                                             
  2045. BOOKLIST:                                                                       
  2046.                                                                                 
  2047. Address "CMS" 'GOPCLI (BOOKLIST'                                                
  2048.                                                                                 
  2049. Return                                                                          
  2050.                                                                                 
  2051.                                                                                 
  2052.                                                                                 
  2053. /* ----------------------------------------------------------------- FIX        
  2054.  * Takes an inbound 3270 DS screen address (two bytes)                          
  2055.  * and returns the equivalent byte offset in decimal.                           
  2056.  */                                                                             
  2057. FIX:                                                                            
  2058. Parse Arg o,.                                                                   
  2059. Parse Var o 1 o1 2 o2 3 .                                                       
  2060. o1 = c2d(o1)                                                                    
  2061. o2 = c2d(o2)                                                                    
  2062. If o1 < 64 Then Return o1 * 256 + o2                                            
  2063.            Else Return (o1 // 64) * 64 + (o2 // 64)                             
  2064.                                                                                 
  2065.                                                                                 
  2066.                                                                                 
  2067. /* ---------------------------------------------------------- WRITE_READ        
  2068.  * Display what we have, then wait for user input and return it.                
  2069.  */                                                                             
  2070. WRITE_READ: Procedure Expose fs.                                                
  2071. Parse Arg ws,wcc,wrt,.                                                          
  2072. If wcc = "" Then wcc = 'C3'x                                                    
  2073. /*  If wrt = "" Then wrt = 'C0'x  */                                            
  2074. If wrt = "" Then wrt = fs.write                                                 
  2075. ws = wrt || wcc || ws                                                           
  2076. 'CALLPIPE VAR WS | FULLSCR' fs.tube '| VAR RS'                                  
  2077. If rc ^= 0 Then rs = '000000'x                                                  
  2078. Return rs                                                                       
  2079.                                                                                 
  2080.                                                                                 
  2081.                                                                                 
  2082. /* ----------------------------------------------------------------- SBA        
  2083.  * (a better SBA function extracted from PIPEDEMO; thanks, Chuck!)              
  2084.  * Construct Set Buffer Address order from row and column.                      
  2085.  */                                                                             
  2086.                                                                                 
  2087. SBA:      Procedure Expose fs.                                                  
  2088.                                                                                 
  2089. arg row , col, .                                                                
  2090. row = Trunc(row)                                                                
  2091. col = Trunc(col)                                                                
  2092.                                                                                 
  2093. /*-----------------------------------------------------------------*/           
  2094. /* Calculate binary address.                                       */           
  2095. /*-----------------------------------------------------------------*/           
  2096.                                                                                 
  2097. offset = row * fs.scrcols + col                                                 
  2098. Do While offset < 0; offset = offset + fs.scrrows * fs.scrcols; End             
  2099.                                                                                 
  2100. if fs.14bit then return '11'x || d2c(offset,2)                                  
  2101.                                                                                 
  2102. /*-----------------------------------------------------------------*/           
  2103. /* Convert to six-bit format. (xxxx111111111111 -> 0011111100111111*/           
  2104. /*-----------------------------------------------------------------*/           
  2105.                                                                                 
  2106. 'CALLPIPE var offset'               ,   /* Start with char number.    */        
  2107.     '| spec 1-* d2c 1.2 right'      ,   /* Convert to binary.         */        
  2108.     '| spec 1-* c2b 1'              ,   /* Convert to bit string.     */        
  2109.     '| spec /00/ 1  5.6  3'         ,   /* Place first six bits.      */        
  2110.            '/00/ 9 11.6 11'         ,   /* Place second six bits.     */        
  2111.     '| spec 1-* b2c 1'              ,   /* Convert back to binary.    */        
  2112.     '| xlate *-* 00-3F 40-7F'       ,   /* Translate to coded         */        
  2113.                 '01-09 C1-C9'       ,   /*   buffer address.          */        
  2114.                 '11-19 D1-D9'       ,   /*                            */        
  2115.                 '22-29 E2-E9'       ,   /*                            */        
  2116.                 '30-39 F0-F9'       ,   /*                            */        
  2117.     '| spec x11 1 1.2 2'            ,   /* Prefix with SBA order.     */        
  2118.     '| var offset'                      /* Put back in variable.      */        
  2119.                                                                                 
  2120. Return offset                                                                   
  2121.                                                                                 
  2122.                                                                                 
  2123.                                                                                 
  2124. /* --------------------------------------------------------------- FIELD        
  2125.  * Generate the 3270 DS sequence for extended field attributes                  
  2126.  * (if available).                                                              
  2127.  */                                                                             
  2128. FIELD:    Procedure Expose fs.                                                  
  2129. a = '00'x                                                                       
  2130. b = '00'x                                                                       
  2131. c = 'F1'x                                                                       
  2132. i = 1                                                                           
  2133. Do While Arg(i) ^= ""                                                           
  2134.     Select  /*  at  */                                                          
  2135.         When Abbrev("PROTECTED",Arg(i),2)   Then a = bitor(a,'20'x)             
  2136.         When Abbrev("SKIP",Arg(i),1)        Then a = bitor(a,'10'x)             
  2137.         When Abbrev("NODISPLAY",Arg(i),1)   Then a = bitor(a,'0C'x)             
  2138.         When Abbrev("HIGH",Arg(i),1)        Then a = bitor(a,'08'x)             
  2139.         When Abbrev("BLINK",Arg(i),3)       Then b = bitor(b,'01'x)             
  2140.         When Abbrev("REVERSE",Arg(i),3)     Then b = bitor(b,'02'x)             
  2141.         When Abbrev("UNDERLINE",Arg(i),1)   Then b = bitor(b,'04'x)             
  2142.         When Abbrev("BLUE",Arg(i),3)        Then c = 'F1'x                      
  2143.         When Abbrev("RED",Arg(i),3)         Then c = 'F2'x                      
  2144.         When Abbrev("PINK",Arg(i),1)        Then c = 'F3'x                      
  2145.         When Abbrev("GREEN",Arg(i),1)       Then c = 'F4'x                      
  2146.         When Abbrev("TURQUOISE",Arg(i),1)   Then c = 'F5'x                      
  2147.         When Abbrev("YELLOW",Arg(i),1)      Then c = 'F6'x                      
  2148.         When Abbrev("WHITE",Arg(i),1)       Then c = 'F7'x                      
  2149.         Otherwise nop                                                           
  2150.         End  /*  Select  at  */                                                 
  2151.     i = i + 1                                                                   
  2152.     End  /*  Do  While  */                                                      
  2153.                                                                                 
  2154. If  ^fs.color   | ,                                                             
  2155.     ^fs.exthi   Then    Return '1D'x || bitor(a,'40'x)                          
  2156.                 Else    Return '2902'x || ,                                     
  2157.                                'C0'x   || bitor(a,'40'x) || ,                   
  2158.                                '42'x   || bitor(c,'40'x)                        
  2159.                                                                                 
  2160.                                                                                 
  2161.                                                                                 
  2162. /* ---------------------------------------------------------------- GTAG        
  2163.  *  Match the gopher data type to a national language  "tag"  string.           
  2164.  */                                                                             
  2165. GTAG:     Procedure                                                             
  2166.                                                                                 
  2167. Parse Arg type                                                                  
  2168.                                                                                 
  2169.     Select  /*  type  */                                                        
  2170.                                                                                 
  2171.         When type = '0' Then _tag = 700                                         
  2172.         When type = '1' Then _tag = 701                                         
  2173.         When type = '2' Then _tag = 702                                         
  2174.         When type = '3' Then _tag = 703                                         
  2175.         When type = '4' Then _tag = 704                                         
  2176.         When type = '5' Then _tag = 705                                         
  2177.         When type = '6' Then _tag = 706                                         
  2178.         When type = '7' Then _tag = 707                                         
  2179.         When type = '8' Then _tag = 708                                         
  2180.         When type = '9' Then _tag = 709                                         
  2181.         When type = 's' Then _tag = 767                                         
  2182.         When type = 'r' Then _tag = 766                                         
  2183.         When type = 'v' Then _tag = 770                                         
  2184.         When type = 'i' Then _tag = 757                                         
  2185.         When type = 'I' Then _tag = 725                                         
  2186.         When type = 'g' Then _tag = 755                                         
  2187.         When type = 'M' Then _tag = 729                                         
  2188.         When type = 'T' Then _tag = 736                                         
  2189.                                                                                 
  2190.         When type = ':' Then _tag = 710                                         
  2191.         When type = ';' Then _tag = 711                                         
  2192.         When type = '<' Then _tag = 712                                         
  2193.                                                                                 
  2194.         Otherwise            _tag = 908                                         
  2195.                                                                                 
  2196.         End  /*  Select  type  */                                               
  2197.                                                                                 
  2198. 'CALLPIPE COMMAND XMITMSG' _tag 'TYPE (APPLID GOP NOHEADER | VAR TAG'           
  2199.                                                                                 
  2200. Return tag                                                                      
  2201.                                                                                 
  2202.                                                                                 
  2203.                                                                                 
  2204. /* ---------------------------------------------------------------- HELP        
  2205.  *  Invoke CMS HELP for GOPHER BROWSER (the menu browser).                      
  2206.  */                                                                             
  2207. HELP:     Procedure Expose fs. message.                                         
  2208.                                                                                 
  2209. If fs.tube ^= "" Then                                                           
  2210.     'CALLPIPE COMMAND HELP GOPHER BROWSER (ALL NOSCREEN' ,                      
  2211.         '| GOPCLIFV BROWSER HELP' ,                                             
  2212.             '| STEM MESSAGE. APPEND'                                            
  2213.                                                                                 
  2214. Else Do                                                                         
  2215.     Address "COMMAND" 'HELP GOPHER BROWSER'                                     
  2216.     Address "COMMAND" 'VMFCLEAR'                                                
  2217.     End  /*  Else  Do  */                                                       
  2218.                                                                                 
  2219. Return                                                                          
  2220.                                                                                 
  2221. :READ  GOPCLIUI REXX     A1 TMP200 01/03/93 16:05:24                            
  2222. /*                                                                              
  2223.  *        Name: GOPCLIUI REXX                                                   
  2224.  *              VM TCP/IP Network GOPHER Client user input                      
  2225.  *      Author: Rick Troth, Rice University, Information Systems                
  2226.  *        Date: 1992-Dec-23                                                     
  2227.  *                                                                              
  2228.  *       Input: a prompt string                                                 
  2229.  *      Output: the user's response                                             
  2230.  *                                                                              
  2231.  *              Untested with multiples,  but should work that way.             
  2232.  */                                                                             
  2233.                                                                                 
  2234. /*                                                                              
  2235.  *      Copyright 1992 Richard M. Troth.   This software was developed          
  2236.  *      with resources provided by Rice University and is intended              
  2237.  *      to serve Rice's user community.   Rice has benefitted greatly           
  2238.  *      from the free distribution of software,  therefore distribution         
  2239.  *      of unmodified copies of this material is not restricted.                
  2240.  *      You may change your own copy as needed.   Neither Rice                  
  2241.  *      University nor any of its employees or students shall be held           
  2242.  *      liable for damages resulting from the use of this software.             
  2243.  */                                                                             
  2244.                                                                                 
  2245. Trace "OFF"                                                                     
  2246.                                                                                 
  2247. /*  fetch fs. stem variable from calling REXX environment  */                   
  2248. 'CALLPIPE REXXVARS 1 | DROP | JOIN 1 /,/' ,                                     
  2249.         '| CHANGE /n /,/ | CHANGE /,v /,/ 1 | LOCATE /FS./ | VARLOAD'           
  2250.                                                                                 
  2251. /*  trouble with plain write,  so fetch current screen contents  */             
  2252. 'CALLPIPE LITERAL 00 | SPEC 1-2 X2C 1' ,                                        
  2253.         '| FULLSCR' fs.tube 'CONDREAD | VAR SCREEN'                             
  2254. Parse Var screen 1 aid 2 cursor 4 screen                                        
  2255.                                                                                 
  2256. Do Forever                                                                      
  2257.                                                                                 
  2258.     'PEEKTO PROMPT'                                                             
  2259.     If rc ^= 0 Then Leave                                                       
  2260.                                                                                 
  2261.     Parse Var prompt prompt ';' preset                                          
  2262.     prompt = Strip(prompt)                                                      
  2263.     preset = Strip(preset)                                                      
  2264.                                                                                 
  2265.     /* --------------------------------------------------------- GPROMPT        
  2266.      *  Present a prompt and read from the Gopher user's screen.                
  2267.      *  Preset response data may have been supplied.                            
  2268.      */                                                                         
  2269.                                                                                 
  2270.     prompt = fs.write || 'C3'x || screen || ,                                   
  2271.             sba(1,-1) || field("PROT","GREEN") || prompt ,                      
  2272.             || field("HIGH","WHITE") || '13'x || preset || ,                    
  2273.             Copies('00'x,fs.scrcols*2-Length(prompt)-Length(preset)-4) ,        
  2274.             || field("PROT")                                                    
  2275.                                                                                 
  2276.     'CALLPIPE VAR PROMPT | FULLSCR' fs.tube '| VAR RS'                          
  2277.     Parse Var rs With 1 aid 2 . 4 rs                                            
  2278.                                                                                 
  2279.     If  aid = '7D'x   /* enter */   Then Do                                     
  2280.         Parse Var rs With . '11'x rs                                            
  2281.         rs = Substr(rs,3)                                                       
  2282.         If rs = "" Then rs = preset                                             
  2283.         'OUTPUT' rs                                                             
  2284.         End  /*  If  ..  Do  */                                                 
  2285.                                                                                 
  2286.     Else 'OUTPUT'                                                               
  2287.                                                                                 
  2288.     'CALLPIPE VAR CURSOR | SPEC /00C311/ X2C 1 1.2 NEXT' ,                      
  2289.             '/13/ X2C NEXT | FULLSCR' fs.tube 'NOREAD | HOLE'                   
  2290.                                                                                 
  2291.     'READTO'                                                                    
  2292.                                                                                 
  2293.     End  /*  Do  Forever  */                                                    
  2294.                                                                                 
  2295. Exit rc * (rc ^= 12)                                                            
  2296.                                                                                 
  2297.                                                                                 
  2298.                                                                                 
  2299.                                                                                 
  2300. /* ----------------------------------------------------------------- SBA        
  2301.  * (a better SBA function extracted from PIPEDEMO; thanks, Chuck!)              
  2302.  * Construct Set Buffer Address order from row and column.                      
  2303.  */                                                                             
  2304.                                                                                 
  2305. SBA:      Procedure Expose fs.                                                  
  2306.                                                                                 
  2307. arg row , col, .                                                                
  2308. row = Trunc(row)                                                                
  2309. col = Trunc(col)                                                                
  2310.                                                                                 
  2311. /*-----------------------------------------------------------------*/           
  2312. /* Calculate binary address.                                       */           
  2313. /*-----------------------------------------------------------------*/           
  2314.                                                                                 
  2315. offset = row * fs.scrcols + col                                                 
  2316. Do While offset < 0; offset = offset + fs.scrrows * fs.scrcols; End             
  2317.                                                                                 
  2318. if fs.14bit then return '11'x || d2c(offset,2)                                  
  2319.                                                                                 
  2320. /*-----------------------------------------------------------------*/           
  2321. /* Convert to six-bit format. (xxxx111111111111 -> 0011111100111111*/           
  2322. /*-----------------------------------------------------------------*/           
  2323.                                                                                 
  2324. 'CALLPIPE var offset'               ,   /* Start with char number.    */        
  2325.     '| spec 1-* d2c 1.2 right'      ,   /* Convert to binary.         */        
  2326.     '| spec 1-* c2b 1'              ,   /* Convert to bit string.     */        
  2327.     '| spec /00/ 1  5.6  3'         ,   /* Place first six bits.      */        
  2328.            '/00/ 9 11.6 11'         ,   /* Place second six bits.     */        
  2329.     '| spec 1-* b2c 1'              ,   /* Convert back to binary.    */        
  2330.     '| xlate *-* 00-3F 40-7F'       ,   /* Translate to coded         */        
  2331.                 '01-09 C1-C9'       ,   /*   buffer address.          */        
  2332.                 '11-19 D1-D9'       ,   /*                            */        
  2333.                 '22-29 E2-E9'       ,   /*                            */        
  2334.                 '30-39 F0-F9'       ,   /*                            */        
  2335.     '| spec x11 1 1.2 2'            ,   /* Prefix with SBA order.     */        
  2336.     '| var offset'                      /* Put back in variable.      */        
  2337.                                                                                 
  2338. Return offset                                                                   
  2339.                                                                                 
  2340.                                                                                 
  2341.                                                                                 
  2342. /* --------------------------------------------------------------- FIELD        
  2343.  * Generate the 3270 DS sequence for extended field attributes                  
  2344.  * (if available).                                                              
  2345.  */                                                                             
  2346. FIELD:    Procedure Expose fs.                                                  
  2347. a = '00'x                                                                       
  2348. b = '00'x                                                                       
  2349. c = 'F1'x                                                                       
  2350. i = 1                                                                           
  2351. Do While Arg(i) ^= ""                                                           
  2352.     Select  /*  at  */                                                          
  2353.         When Abbrev("PROTECTED",Arg(i),2)   Then a = bitor(a,'20'x)             
  2354.         When Abbrev("SKIP",Arg(i),1)        Then a = bitor(a,'10'x)             
  2355.         When Abbrev("NODISPLAY",Arg(i),1)   Then a = bitor(a,'0C'x)             
  2356.         When Abbrev("HIGH",Arg(i),1)        Then a = bitor(a,'08'x)             
  2357.         When Abbrev("BLINK",Arg(i),3)       Then b = bitor(b,'01'x)             
  2358.         When Abbrev("REVERSE",Arg(i),3)     Then b = bitor(b,'02'x)             
  2359.         When Abbrev("UNDERLINE",Arg(i),1)   Then b = bitor(b,'04'x)             
  2360.         When Abbrev("BLUE",Arg(i),3)        Then c = 'F1'x                      
  2361.         When Abbrev("RED",Arg(i),3)         Then c = 'F2'x                      
  2362.         When Abbrev("PINK",Arg(i),1)        Then c = 'F3'x                      
  2363.         When Abbrev("GREEN",Arg(i),1)       Then c = 'F4'x                      
  2364.         When Abbrev("TURQUOISE",Arg(i),1)   Then c = 'F5'x                      
  2365.         When Abbrev("YELLOW",Arg(i),1)      Then c = 'F6'x                      
  2366.         When Abbrev("WHITE",Arg(i),1)       Then c = 'F7'x                      
  2367.         Otherwise nop                                                           
  2368.         End  /*  Select  at  */                                                 
  2369.     i = i + 1                                                                   
  2370.     End  /*  Do  While  */                                                      
  2371.                                                                                 
  2372. If  ^fs.color   | ,                                                             
  2373.     ^fs.exthi   Then    Return '1D'x || bitor(a,'40'x)                          
  2374.                 Else    Return '2902'x || ,                                     
  2375.                                'C0'x   || bitor(a,'40'x) || ,                   
  2376.                                '42'x   || bitor(c,'40'x)                        
  2377.                                                                                 
  2378. :READ  GOPCLITX REXX     A1 TMP200 01/24/93 23:28:42                            
  2379. /*                                                                              
  2380.  *        Name: GOPCLITX REXX                                                   
  2381.  *              VM TCP/IP Network GOPHER Client plain-text processor            
  2382.  *      Author: Rick Troth, Rice University, Information Systems                
  2383.  *        Date: 1992-Dec-23                                                     
  2384.  *                                                                              
  2385.  *       Input: raw ASCII text                                                  
  2386.  *      Output: plain (EBCDIC) text                                             
  2387.  */                                                                             
  2388.                                                                                 
  2389. /*                                                                              
  2390.  *      Copyright 1992 Richard M. Troth.   This software was developed          
  2391.  *      with resources provided by Rice University and is intended              
  2392.  *      to serve Rice's user community.   Rice has benefitted greatly           
  2393.  *      from the free distribution of software,  therefore distribution         
  2394.  *      of unmodified copies of this material is not restricted.                
  2395.  *      You may change your own copy as needed.   Neither Rice                  
  2396.  *      University nor any of its employees or students shall be held           
  2397.  *      liable for damages resulting from the use of this software.             
  2398.  */                                                                             
  2399.                                                                                 
  2400. /*  Trace "OFF"  */                                                             
  2401.                                                                                 
  2402. /*  sync with input so that 'CALLPIPE COMMAND' will work  */                    
  2403. 'PEEKTO'                                                                        
  2404.                                                                                 
  2405. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER GET GOPHER'                             
  2406. If gopher = "" Then gopher = "Gopher"                                           
  2407.                                                                                 
  2408. 'ADDPIPE *: | DEBLOCK LINEND 0A | DROP LAST 1' ,                                
  2409.         '| CHANGE' '000D002000'x '| TCPA2E' gopher '| *.INPUT:'                 
  2410.                                                                                 
  2411. /*                                                                              
  2412.  *        Name: DROPDOTS REXX                                                   
  2413.  *              drop trailing lines consisting of only "."                      
  2414.  *              (typically used for end-of-file indication)                     
  2415.  *        Date: 1992-Apr-18, 20                                                 
  2416.  */                                                                             
  2417.                                                                                 
  2418. dots = 0                                                                        
  2419. 'READTO LINE'                                                                   
  2420. Do While rc = 0                                                                 
  2421.     If Left(line,1) = "." Then Do                                               
  2422.         dots = dots + 1                                                         
  2423.         line.dots = line                                                        
  2424.         End  /*  If  ..  Do  */                                                 
  2425.     Else Do                                                                     
  2426.         Do i = 1 to dots;  'OUTPUT' line.i;  End                                
  2427.         dots = 0                                                                
  2428.         'OUTPUT' line                                                           
  2429.         End  /*  Else  Do  */                                                   
  2430.     'READTO LINE'                                                               
  2431.     End  /*  Do  While  */                                                      
  2432.                                                                                 
  2433. Exit                                                                            
  2434.                                                                                 
  2435. :READ  GOPCLIFV REXX     A1 TMP200 01/21/93 13:16:41                            
  2436. /*                                                                              
  2437.  *        Name: GOPCLIFV REXX                                                   
  2438.  *              VM TCP/IP Network GOPHER Client file viewer                     
  2439.  *      Author: Rick Troth, Rice University, Information Systems                
  2440.  *        Date: 1992-Dec-23                                                     
  2441.  *                                                                              
  2442.  *       Input: a plain-text file to view                                       
  2443.  *      Output: zero or more information or error messages                      
  2444.  */                                                                             
  2445.                                                                                 
  2446. /*                                                                              
  2447.  *      Copyright 1992 Richard M. Troth.   This software was developed          
  2448.  *      with resources provided by Rice University and is intended              
  2449.  *      to serve Rice's user community.   Rice has benefitted greatly           
  2450.  *      from the free distribution of software,  therefore distribution         
  2451.  *      of unmodified copies of this material is not restricted.                
  2452.  *      You may change your own copy as needed.   Neither Rice                  
  2453.  *      University nor any of its employees or students shall be held           
  2454.  *      liable for damages resulting from the use of this software.             
  2455.  */                                                                             
  2456.                                                                                 
  2457. Trace "OFF"                                                                     
  2458.                                                                                 
  2459. Parse Arg args '(' . ')' .                                                      
  2460.                                                                                 
  2461. /*  verify availability of input  */                                            
  2462. 'PEEKTO'                                                                        
  2463. If rc ^= 0 & rc ^= 12 Then Exit rc                                              
  2464. If rc = 12 Then Do  /*  Warning: file is empty  */                              
  2465.     'CALLPIPE COMMAND XMITMSG 559 (ERRMSG | *:'                                 
  2466.     Exit                                                                        
  2467.     End  /*  If  ..  Do  */                                                     
  2468.                                                                                 
  2469. Address "COMMAND" 'GLOBALV SELECT GOPHER GET' ,                                 
  2470.         'GOPHER PROGID VIEWER ITEM'                                             
  2471. quit = 0                                                                        
  2472.                                                                                 
  2473. Parse Var item name '05'x path '05'x host '05'x port '05'x xtra                 
  2474. Parse Var name 1 . 2 name       /*  discard type indicator byte  */             
  2475. Parse Var path 1 . 2 path       /*  discard type indicarot byte  */             
  2476. If name = "" Then name = args                                                   
  2477.                                                                                 
  2478. /*  fetch fs. stem variable from GlobalVs  */                                   
  2479. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER LIST | DROP' ,                          
  2480.         '| LOCATE 1-4 / FS./ | SPEC /=/ 1 2-* NEXT | VARLOAD'                   
  2481. If rc ^= 0 Then Address "COMMAND" 'EXEC GOPCLINI'                               
  2482. If ^Datatype(fs.tube,'X') Then fs.tube = ""                                     
  2483.                                                                                 
  2484. message.0 = 0                                                                   
  2485. command = ""                                                                    
  2486.                                                                                 
  2487. Select  /*  viewer  */                                                          
  2488.     When viewer = ""         Then Call BUILT_IN                                 
  2489.     When viewer = "XEDIT"    Then Call XEDIT                                    
  2490.     When viewer = "BROWSE"   Then Call BROWSE                                   
  2491.     Otherwise                     Call ANYOTHER                                 
  2492.     /*                                                                          
  2493.         handle disk-full conditions!                                            
  2494.      */                                                                         
  2495.     End  /*  Select  viewer  */                                                 
  2496. vrc = rc                                                                        
  2497.                                                                                 
  2498. 'CALLPIPE STEM MESSAGE. | *:'                                                   
  2499.                                                                                 
  2500. Parse Upper Var command cmdverb .                                               
  2501. Address "COMMAND" 'GLOBALV SELECT GOPHER PUT' ,                                 
  2502.         'COMMAND CMDVERB'                                                       
  2503.                                                                                 
  2504. Exit vrc                                                                        
  2505.                                                                                 
  2506.                                                                                 
  2507. /* ============================================================ BUILT_IN        
  2508.  */                                                                             
  2509. BUILT_IN:                                                                       
  2510.                                                                                 
  2511. /*  read the file from the preceding stage  */                                  
  2512. 'CALLPIPE *: | EXPAND | XLATE OUTPUT | XLATE *-* 00-3F 40 FF 40' ,              
  2513.         '| DEBLOCK FIXED' fs.scrcols + 1 '| STEM FILE.'                         
  2514.                                                                                 
  2515. /*  display the file and process user's response  */                            
  2516. row = 3;        col = 0                                                         
  2517. ki = file.0;    kl = fs.scrrows - 5;    ko = 1                                  
  2518. needle = ""     /*  may be re-used within this context  */                      
  2519.                                                                                 
  2520. 'CALLPIPE COMMAND XMITMSG 614 (APPLID GOP' ,                                    
  2521.         'NOCOMP NOHEADER | STEM HELP.'                                          
  2522.                                                                                 
  2523. 'CALLPIPE COMMAND XMITMSG 5 (APPLID GOP NOHEADER | VAR MORE'                    
  2524.                                                                                 
  2525. Do Forever                                                                      
  2526.                                                                                 
  2527.     /*  write the program title line  */                                        
  2528.     wscreen = sba(0,-1) || field("BLUE","PROT") || sba(0,0) || progid ,         
  2529.                         || sba(0,fs.scrcols-Length(host)-1) || host             
  2530.                                                                                 
  2531.     /*  no SBA for status because it follows host immediately  */               
  2532.     If message.0 < 1 Then Do                                                    
  2533.     wscreen = wscreen   || field("PROT") || Left(ko || '/' || ki, 11)           
  2534.     If ko + kl <= ki Then                                                       
  2535.     wscreen = wscreen   || field("WHITE","HIGH","PROT") || more                 
  2536.         End  /*  If  ..  Do  */                                                 
  2537.                                                                                 
  2538.     /*  don't write status or name if they'll be overlaid  */                   
  2539.     If message.0 < 2 Then                                                       
  2540.     wscreen = wscreen   || sba(2,(fs.scrcols-Length(name))/2) ,                 
  2541.                         || field("WHITE","PROT") || name                        
  2542.                                                                                 
  2543.     /*  write as many message lines as needed  */                               
  2544.     If message.0 > 0 Then Do                                                    
  2545.         Do i = 1 to message.0                                                   
  2546.             wscreen = wscreen || sba(i,-1) ,                                    
  2547.                 || field("RED","HIGH","PROT") || message.i                      
  2548.             End  /*  Do  For  */                                                
  2549.         message.0 = 0                                                           
  2550.         End  /*  If  ..  Do  */                                                 
  2551.     /*  we should probably limit that count  */                                 
  2552.                                                                                 
  2553.     /*  write those PFkey settings  */                                          
  2554.     wscreen = wscreen   || sba(fs.scrrows-2,-1) ,                               
  2555.                         || field("BLUE","PROT") ,                               
  2556.                         || help.1 ,                                             
  2557.                         || sba(fs.scrrows-1,-1) ,                               
  2558.                         || field("BLUE","PROT") ,                               
  2559.                         || help.2                                               
  2560.                                                                                 
  2561.     i = 1; j = ko                                                               
  2562.     Do While i <= kl & j <= ki                                                  
  2563.                                                                                 
  2564. /*      'CALLPIPE VAR FILE.' || i '| XLATE OUTPUT' ,                            
  2565.             '| XLATE *-* 00-3F 40 FF 40 | VAR _LINE'                  */        
  2566.                                                                                 
  2567.         wscreen = wscreen || sba(i+2,-1) || field("GREEN","PROT")               
  2568.         wscreen = wscreen || file.j                                             
  2569.         i = i + 1;  j = j + 1                                                   
  2570.         End                                                                     
  2571.                                                                                 
  2572.     rscreen = write_read(wscreen || sba(row,col) || '13'x)                      
  2573.     Parse Var rscreen 1 aid 2 offset . '11'x rscreen                            
  2574.     offset = fix(offset)                                                        
  2575.     row = offset % fs.scrcols; col = offset // fs.scrcols                       
  2576.                                                                                 
  2577.     /*  keep the  row/col  values within bounds  */                             
  2578.     row = 3     /* just reset it */                                             
  2579.     col = 0     /* just reset it */                                             
  2580.                                                                                 
  2581.     Select /* aid */                                                            
  2582.         When  aid = '7D'x   /* enter */ Then nop                                
  2583.         When  aid = 'F2'x   /*  PF2  */ | ,                                     
  2584.               aid = 'C2'x   /*  PF14 */ | ,                                     
  2585.               aid = '7B'x   /*  PF11 */ | ,                                     
  2586.               aid = '4B'x   /*  PF23 */ Then Call SUBXEDIT                      
  2587.         When  aid = 'F3'x   /*  PF3  */ | ,                                     
  2588.               aid = 'C3'x   /*  PF15 */ Then Leave                              
  2589.         When  aid = 'F4'x   /*  PF4  */ | ,                                     
  2590.               aid = 'C4'x   /*  PF16 */ Then Call PRINT                         
  2591.         When  aid = 'F5'x   /*  PF5  */ | ,                                     
  2592.               aid = 'C5'x   /*  PF17 */ Then Call SAVE                          
  2593.         When  aid = 'F6'x   /*  PF6  */ | ,                                     
  2594.               aid = 'C6'x   /*  PF18 */ Then Call FIND                          
  2595.         When  aid = 'F7'x   /*  PF7  */ | ,                                     
  2596.               aid = 'C7'x   /*  PF19 */ Then ko = Max(ko-kl+1,1)                
  2597.         When  aid = 'F8'x   /*  PF8  */ | ,                                     
  2598.               aid = 'C8'x   /*  PF20 */ Then ko = Min(ko+kl-1,ki)               
  2599.         When  aid = 'F9'x   /*  PF9  */ | ,                                     
  2600.               aid = 'C9'x   /*  PF21 */ Then  Call  MARK                        
  2601.         When  aid = '7A'x   /*  PF10 */ | ,                                     
  2602.               aid = '4A'x   /*  PF22 */ Then  Call  BOOKLIST                    
  2603.         When  aid = '6D'x   /* clear */ | ,                                     
  2604.               aid = '6E'x   /*  PA2  */ Then Do                                 
  2605.             row = 3; col = 0; ko = 1                                            
  2606.             End  /*  When ..  Do  */                                            
  2607.         When  aid = '7C'x   /*  PF12 */ | ,                                     
  2608.               aid = '4C'x   /*  PF24 */ | ,                                     
  2609.               aid = 'F0'x   /* sysrq */ | ,                                     
  2610.               aid = '6C'x   /*  PA1  */ Then  quit = 1                          
  2611.         When  aid = 'F1'x   /*  PF1  */ | ,                                     
  2612.               aid = 'C1'x   /*  PF13 */ Then  Call  HELP                        
  2613.         When  aid = '00'x               Then Do                                 
  2614.             /*  I/O error on screen  */                                         
  2615.             'CALLPIPE COMMAND XMITMSG 925 (APPLID GOP' ,                        
  2616.                     'CALLER FVW ERRMSG | STEM MESSAGE. APPEND'                  
  2617.               Leave                                                             
  2618.               End                                                               
  2619.         Otherwise  Do   /*  Undefined PFkey/PAkey  */                           
  2620.             'CALLPIPE COMMAND XMITMSG 657 "' || c2x(aid) || '"' ,               
  2621.                 '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'          
  2622.             End  /*  Otherwise  Do  */                                          
  2623.         End  /*  Select  aid  */                                                
  2624.                                                                                 
  2625.     If quit Then Leave                                                          
  2626.                                                                                 
  2627.     End  /*  Do  Forever  */                                                    
  2628.                                                                                 
  2629. If quit Then command = "QUIT"                                                   
  2630.                                                                                 
  2631. Return                                                                          
  2632.                                                                                 
  2633.                                                                                 
  2634.                                                                                 
  2635. /* =============================================================== XEDIT        
  2636.  *  Take the "file" from the input stream and pass it to CMS XEDIT.             
  2637.  */                                                                             
  2638. XEDIT:                                                                          
  2639.                                                                                 
  2640. If fs.tube ^= "" Then Do                                                        
  2641.     /*  "Can't run XEDIT on this terminal."  */                                 
  2642.     'CALLPIPE COMMAND XMITMSG 512 "XEDIT"' ,                                    
  2643.             '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'              
  2644.     Return                                                                      
  2645.     End /* If .. Do */                                                          
  2646.                                                                                 
  2647. /*  stash this in a temporary file  */                                          
  2648. 'CALLPIPE *: | > VMGOPHER DOCUMENT A3'                                          
  2649.                                                                                 
  2650. /*  what's the real name of the file?  */                                       
  2651. Parse Value gopclifi(path) With fn ft .                                         
  2652. Push "COMMAND SET FNAME" fn                                                     
  2653. Push "COMMAND SET FTYPE" ft                                                     
  2654. Push "COMMAND SET FMODE A1"                                                     
  2655.                                                                                 
  2656. /*  now invoke XEDIT  */                                                        
  2657. 'CALLPIPE COMMAND STATE GOPXEDPR XEDIT *'                                       
  2658. If rc = 0 Then Address "COMMAND" ,                                              
  2659.                 'XEDIT VMGOPHER DOCUMENT A (PROFILE GOPXEDPR'                   
  2660.           Else Address "COMMAND" ,                                              
  2661.                 'XEDIT VMGOPHER DOCUMENT A'                                     
  2662.                                                                                 
  2663. Return                                                                          
  2664.                                                                                 
  2665.                                                                                 
  2666.                                                                                 
  2667. /* ============================================================== BROWSE        
  2668.  *  Take the "file" from the input stream and pass it to CMS BROWSE.            
  2669.  */                                                                             
  2670. BROWSE:                                                                         
  2671.                                                                                 
  2672. If fs.tube ^= "" Then Do                                                        
  2673.     /*  "Can't run BROWSE on this terminal."  */                                
  2674.     'CALLPIPE COMMAND XMITMSG 512 "BROWSE"' ,                                   
  2675.             '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'              
  2676.     Return                                                                      
  2677.     End /* If .. Do */                                                          
  2678.                                                                                 
  2679. Parse Value gopclifi(path) With fn ft .                                         
  2680. filespec = fn ft 'A'                                                            
  2681.                                                                                 
  2682. 'CALLPIPE CMS STATE' filespec '| STEM MESSAGE.'                                 
  2683. If  rc ^= 0 & rc ^= 28 & rc ^= 20  Then Return                                  
  2684. If  rc = 0 | rc = 20  Then Do                                                   
  2685.     fn = "VMGOPHER"                                                             
  2686.     ft = "DOCUMENT"                                                             
  2687.     End  /*  If  ..  Do  */                                                     
  2688. message.0 = 0                                                                   
  2689.                                                                                 
  2690. /*  stash this in a temporary file  */                                          
  2691. 'CALLPIPE *: | >' fn ft 'A3'                                                    
  2692.                                                                                 
  2693. /* stash this in a temporary file and invoke BROWSE */                          
  2694. Address "COMMAND" 'BROWSE' filespec                                             
  2695.                                                                                 
  2696. Return                                                                          
  2697.                                                                                 
  2698.                                                                                 
  2699.                                                                                 
  2700. /* ============================================================ ANYOTHER        
  2701.  *  View the file with some unknown text editor or file browser.                
  2702.  */                                                                             
  2703. ANYOTHER:                                                                       
  2704.                                                                                 
  2705. If fs.tube ^= "" Then Do                                                        
  2706.     /*  "Can't run" viewer "on this terminal."  */                              
  2707.     'CALLPIPE COMMAND XMITMSG 512 VIEWER' ,                                     
  2708.             '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'              
  2709.     Return                                                                      
  2710.     End /* If .. Do */                                                          
  2711.                                                                                 
  2712. Parse Value gopclifi(path) With fn ft .                                         
  2713. filespec = fn ft 'A'                                                            
  2714.                                                                                 
  2715. 'CALLPIPE CMS STATE' filespec '| STEM MESSAGE.'                                 
  2716. If  rc ^= 0 & rc ^= 28 & rc ^= 20  Then Return                                  
  2717. If  rc = 0 | rc = 20  Then Do                                                   
  2718.     fn = "VMGOPHER"                                                             
  2719.     ft = "DOCUMENT"                                                             
  2720.     End  /*  If  ..  Do  */                                                     
  2721. message.0 = 0                                                                   
  2722.                                                                                 
  2723. /*  stash this in a temporary file  */                                          
  2724. 'CALLPIPE *: | >' fn ft 'A3'                                                    
  2725.                                                                                 
  2726. /* stash this in a temporary file and invoke the viewer  */                     
  2727. 'CALLPIPE CMS' viewer filespec '| CONSOLE'                                      
  2728.                                                                                 
  2729. Return                                                                          
  2730.                                                                                 
  2731.                                                                                 
  2732.                                                                                 
  2733. /* ---------------------------------------------------------------- HELP        
  2734.  * Invoke CMS HELP passing any supplied argument (context sensitive).           
  2735.  */                                                                             
  2736. HELP:     Procedure Expose fs. message.                                         
  2737.                                                                                 
  2738. If fs.tube ^= "" Then                                                           
  2739.     'CALLPIPE COMMAND HELP GOPHER VIEWER (ALL' ,                                
  2740.         '| GOPCLIFV VIEWER HELP' ,                                              
  2741.             '| STEM MESSAGE. APPEND'                                            
  2742.                                                                                 
  2743. Else Do                                                                         
  2744.     'CALLPIPE COMMAND HELP GOPHER VIEWER'                                       
  2745.     Address "COMMAND" 'VMFCLEAR'                                                
  2746.     End  /*  Else  Do  */                                                       
  2747.                                                                                 
  2748. Return                                                                          
  2749.                                                                                 
  2750.                                                                                 
  2751.                                                                                 
  2752. /* ------------------------------------------------------------ SUBXEDIT        
  2753.  *  Take the file in storage and pass it to CMS XEDIT.                          
  2754.  */                                                                             
  2755. SUBXEDIT:                                                                       
  2756.                                                                                 
  2757. If fs.tube ^= "" Then Do                                                        
  2758.     /*  "Can't run XEDIT on this terminal."  */                                 
  2759.     'CALLPIPE COMMAND XMITMSG 512 "XEDIT"' ,                                    
  2760.             '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'              
  2761.     Return                                                                      
  2762.     End /* If .. Do */                                                          
  2763.                                                                                 
  2764. /*  stash this in a temporary file  */                                          
  2765. 'CALLPIPE STEM FILE. | > VMGOPHER DOCUMENT A3'                                  
  2766.                                                                                 
  2767. /*  what's the real name of the file?  */                                       
  2768. Parse Value gopclifi(path) With fn ft .                                         
  2769. Push "COMMAND SET FNAME" fn                                                     
  2770. Push "COMMAND SET FTYPE" ft                                                     
  2771. Push "COMMAND SET FMODE A1"                                                     
  2772.                                                                                 
  2773. /*  now invoke XEDIT  */                                                        
  2774. 'CALLPIPE COMMAND STATE GOPXEDPR XEDIT *'                                       
  2775. If rc = 0 Then Address "COMMAND" ,                                              
  2776.                 'XEDIT VMGOPHER DOCUMENT A (PROFILE GOPXEDPR'                   
  2777.           Else Address "COMMAND" ,                                              
  2778.                 'XEDIT VMGOPHER DOCUMENT A'                                     
  2779.                                                                                 
  2780. Return                                                                          
  2781.                                                                                 
  2782.                                                                                 
  2783.                                                                                 
  2784. /* --------------------------------------------------------------- PRINT        
  2785.  *  Take the current "file" in context and send it to the user's                
  2786.  *  virtual printer.  Printer may be SPOOLed CONTinuous.                        
  2787.  */                                                                             
  2788. PRINT:                                                                          
  2789.                                                                                 
  2790. If fs.tube ^= "" Then Do                                                        
  2791.     /*  "Can't PRINT from this terminal."  */                                   
  2792.     'CALLPIPE COMMAND XMITMSG 507 (APPLID GOP CALLER FVW ERRMSG' ,              
  2793.             '| STEM MESSAGE. APPEND'                                            
  2794.     Return                                                                      
  2795.     End /* If .. Do */                                                          
  2796.                                                                                 
  2797. 'CALLPIPE STEM FILE. | PRINT (TITLE' name '| STEM MESSAGE. APPEND'              
  2798.                                                                                 
  2799. Return                                                                          
  2800.                                                                                 
  2801.                                                                                 
  2802.                                                                                 
  2803. /* ---------------------------------------------------------------- SAVE        
  2804.  * Save the current file being viewed to the user's A disk.                     
  2805.  */                                                                             
  2806. SAVE:                                                                           
  2807.                                                                                 
  2808. If fs.tube ^= "" Then Do                                                        
  2809.     Call MESSAGE "Can't SAVE files via this terminal."                          
  2810.     Return                                                                      
  2811.     End /* If .. Do */                                                          
  2812.                                                                                 
  2813. Parse Value gopclifi(path) With fn ft .                                         
  2814. filespec = fn ft 'A'                                                            
  2815.                                                                                 
  2816. 'CALLPIPE CMS STATE' filespec '| STEM MESSAGE.'                                 
  2817. If rc = 0 Then Do                                                               
  2818.     'CALLPIPE COMMAND XMITMSG 24 FILESPEC' ,                                    
  2819.         '| SPLIT AT /;/ | TAKE | STEM MESSAGE.'                                 
  2820.     Return                                                                      
  2821.     End  /*  If  ..  Do  */                                                     
  2822. If rc ^= 28 Then Return                                                         
  2823. message.0 = 0                                                                   
  2824.                                                                                 
  2825. 'CALLPIPE STEM FILE. | >' filespec                                              
  2826. If rc = 0 Then Do                                                               
  2827.     /*  Creating new file:  */                                                  
  2828.     'CALLPIPE COMMAND XMITMSG 571 | STEM MESSAGE. APPEND'                       
  2829.     message.1 = message.1 filespec                                              
  2830. /*  Call message "Created" filespec "from" path  */                             
  2831.     End  /*  If  ..  Do  */                                                     
  2832.                                                                                 
  2833. Return                                                                          
  2834.                                                                                 
  2835.                                                                                 
  2836.                                                                                 
  2837. /* ---------------------------------------------------------------- FIND        
  2838.  *  Find a particular string within the file being viewed.                      
  2839.  */                                                                             
  2840. FIND:                                                                           
  2841.                                                                                 
  2842. 'CALLPIPE COMMAND XMITMSG 602 "' || needle || '" (APPLID GOP' ,                 
  2843.         'CALLER MNU NOHEADER | GOPCLIUI | VAR NEEDLE'                           
  2844. needle = Translate(Strip(needle))                                               
  2845. If needle = "" Then Return                                                      
  2846.                                                                                 
  2847. Do i = ko + 1 to ki                                                             
  2848.     If Index(Translate(file.i),needle) > 0 Then Do                              
  2849.         ko = i                                                                  
  2850.         Return                                                                  
  2851.         End  /*  If  ..  Do  */                                                 
  2852.     End  /*  Do  For  */                                                        
  2853.                                                                                 
  2854. /*  'CALLPIPE COMMAND XMITMSG 546 (ERRMSG'  CALLER DMS is OK  */                
  2855. /*  "Target not found"  */                                                      
  2856. 'CALLPIPE COMMAND XMITMSG 546 (APPLID GOP CALLER MNU ERRMSG' ,                  
  2857.         '| STEM MESSAGE. APPEND'                                                
  2858.                                                                                 
  2859. Return                                                                          
  2860.                                                                                 
  2861.                                                                                 
  2862.                                                                                 
  2863.                                                                                 
  2864. /* ---------------------------------------------------------------- MARK        
  2865.  *  Save a book mark referencing this file.                                     
  2866.  */                                                                             
  2867. MARK:                                                                           
  2868.                                                                                 
  2869. If fs.tube ^= "" Then Do                                                        
  2870.     /*  "Can't set bookmarks from this screen."  */                             
  2871.     'CALLPIPE COMMAND XMITMSG 43 (APPLID GOP CALLER FVW ERRMSG' ,               
  2872.             '| STEM MESSAGE. APPEND'                                            
  2873.     Return                                                                      
  2874.     End /* If .. Do */                                                          
  2875.                                                                                 
  2876. Address "COMMAND" 'GLOBALV SELECT GOPHER GET BOOKMARK.0'                        
  2877. If ^Datatype(bookmark.0,'N') Then bookmark.0 = 0                                
  2878. i = bookmark.0 + 1                                                              
  2879. bookmark.i = item                                                               
  2880. Address "COMMAND" 'GLOBALV SELECT GOPHER PUTP BOOKMARK.' || i                   
  2881. bookmark.0 = i                                                                  
  2882. Address "COMMAND" 'GLOBALV SELECT GOPHER PUTP BOOKMARK.0'                       
  2883.                                                                                 
  2884. If rc = 0 Then 'CALLPIPE COMMAND XMITMSG 41 I' ,                                
  2885.     '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'                      
  2886.     /*  "Bookmark" i "saved."  */                                               
  2887.           Else 'CALLPIPE COMMAND XMITMSG 514 RC "GLOBALV"' ,                    
  2888.         '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'                  
  2889.                                                                                 
  2890. Return                                                                          
  2891.                                                                                 
  2892.                                                                                 
  2893.                                                                                 
  2894. /* ------------------------------------------------------------ BOOKLIST        
  2895.  *  Call GOPCLI to show the lit of bookmarks.                                   
  2896.  */                                                                             
  2897. BOOKLIST:                                                                       
  2898.                                                                                 
  2899. Address "CMS" 'GOPCLI (BOOKLIST'                                                
  2900.                                                                                 
  2901. Return                                                                          
  2902.                                                                                 
  2903.                                                                                 
  2904.                                                                                 
  2905. /* ----------------------------------------------------------------- FIX        
  2906.  * Takes an inbound 3270 DS screen address (two bytes)                          
  2907.  * and returns the equivalent byte offset in decimal.                           
  2908.  */                                                                             
  2909. FIX:                                                                            
  2910. Parse Arg o,.                                                                   
  2911. Parse Var o 1 o1 2 o2 3 .                                                       
  2912. o1 = c2d(o1)                                                                    
  2913. o2 = c2d(o2)                                                                    
  2914. If o1 < 64 Then Return o1 * 256 + o2                                            
  2915.            Else Return (o1 // 64) * 64 + (o2 // 64)                             
  2916.                                                                                 
  2917.                                                                                 
  2918.                                                                                 
  2919. /* ---------------------------------------------------------- WRITE_READ        
  2920.  * Display what we have, then wait for user input and return it.                
  2921.  */                                                                             
  2922. WRITE_READ: Procedure Expose fs.                                                
  2923. Parse Arg ws,wcc,wrt,.                                                          
  2924. If wcc = "" Then wcc = 'C3'x                                                    
  2925. /*  If wrt = "" Then wrt = 'C0'x  */                                            
  2926. If wrt = "" Then wrt = fs.write                                                 
  2927. ws = wrt || wcc || ws                                                           
  2928. 'CALLPIPE VAR WS | FULLSCR' fs.tube '| VAR RS'                                  
  2929. If rc ^= 0 Then rs = '000000'x                                                  
  2930. Return rs                                                                       
  2931.                                                                                 
  2932.                                                                                 
  2933.                                                                                 
  2934. /* ----------------------------------------------------------------- SBA        
  2935.  * (a better SBA function extracted from PIPEDEMO; thanks, Chuck!)              
  2936.  * Construct Set Buffer Address order from row and column.                      
  2937.  */                                                                             
  2938.                                                                                 
  2939. SBA:      Procedure Expose fs.                                                  
  2940.                                                                                 
  2941. arg row , col, .                                                                
  2942. row = Trunc(row)                                                                
  2943. col = Trunc(col)                                                                
  2944.                                                                                 
  2945. /*-----------------------------------------------------------------*/           
  2946. /* Calculate binary address.                                       */           
  2947. /*-----------------------------------------------------------------*/           
  2948.                                                                                 
  2949. offset = row * fs.scrcols + col                                                 
  2950. Do While offset < 0; offset = offset + fs.scrrows * fs.scrcols; End             
  2951.                                                                                 
  2952. if fs.14bit then return '11'x || d2c(offset,2)                                  
  2953.                                                                                 
  2954. /*-----------------------------------------------------------------*/           
  2955. /* Convert to six-bit format. (xxxx111111111111 -> 0011111100111111*/           
  2956. /*-----------------------------------------------------------------*/           
  2957.                                                                                 
  2958. 'CALLPIPE var offset'               ,   /* Start with char number.    */        
  2959.     '| spec 1-* d2c 1.2 right'      ,   /* Convert to binary.         */        
  2960.     '| spec 1-* c2b 1'              ,   /* Convert to bit string.     */        
  2961.     '| spec /00/ 1  5.6  3'         ,   /* Place first six bits.      */        
  2962.            '/00/ 9 11.6 11'         ,   /* Place second six bits.     */        
  2963.     '| spec 1-* b2c 1'              ,   /* Convert back to binary.    */        
  2964.     '| xlate *-* 00-3F 40-7F'       ,   /* Translate to coded         */        
  2965.                 '01-09 C1-C9'       ,   /*   buffer address.          */        
  2966.                 '11-19 D1-D9'       ,   /*                            */        
  2967.                 '22-29 E2-E9'       ,   /*                            */        
  2968.                 '30-39 F0-F9'       ,   /*                            */        
  2969.     '| spec x11 1 1.2 2'            ,   /* Prefix with SBA order.     */        
  2970.     '| var offset'                      /* Put back in variable.      */        
  2971.                                                                                 
  2972. Return offset                                                                   
  2973.                                                                                 
  2974.                                                                                 
  2975.                                                                                 
  2976. /* --------------------------------------------------------------- FIELD        
  2977.  * Generate the 3270 DS sequence for extended field attributes                  
  2978.  * (if available).                                                              
  2979.  */                                                                             
  2980. FIELD:    Procedure Expose fs.                                                  
  2981. a = '00'x                                                                       
  2982. b = '00'x                                                                       
  2983. c = 'F1'x                                                                       
  2984. i = 1                                                                           
  2985. Do While Arg(i) ^= ""                                                           
  2986.     Select  /*  at  */                                                          
  2987.         When Abbrev("PROTECTED",Arg(i),2)   Then a = bitor(a,'20'x)             
  2988.         When Abbrev("SKIP",Arg(i),1)        Then a = bitor(a,'10'x)             
  2989.         When Abbrev("NODISPLAY",Arg(i),1)   Then a = bitor(a,'0C'x)             
  2990.         When Abbrev("HIGH",Arg(i),1)        Then a = bitor(a,'08'x)             
  2991.         When Abbrev("BLINK",Arg(i),3)       Then b = bitor(b,'01'x)             
  2992.         When Abbrev("REVERSE",Arg(i),3)     Then b = bitor(b,'02'x)             
  2993.         When Abbrev("UNDERLINE",Arg(i),1)   Then b = bitor(b,'04'x)             
  2994.         When Abbrev("BLUE",Arg(i),3)        Then c = 'F1'x                      
  2995.         When Abbrev("RED",Arg(i),3)         Then c = 'F2'x                      
  2996.         When Abbrev("PINK",Arg(i),1)        Then c = 'F3'x                      
  2997.         When Abbrev("GREEN",Arg(i),1)       Then c = 'F4'x                      
  2998.         When Abbrev("TURQUOISE",Arg(i),1)   Then c = 'F5'x                      
  2999.         When Abbrev("YELLOW",Arg(i),1)      Then c = 'F6'x                      
  3000.         When Abbrev("WHITE",Arg(i),1)       Then c = 'F7'x                      
  3001.         Otherwise nop                                                           
  3002.         End  /*  Select  at  */                                                 
  3003.     i = i + 1                                                                   
  3004.     End  /*  Do  While  */                                                      
  3005.                                                                                 
  3006. If  ^fs.color   | ,                                                             
  3007.     ^fs.exthi   Then    Return '1D'x || bitor(a,'40'x)                          
  3008.                 Else    Return '2902'x || ,                                     
  3009.                                'C0'x   || bitor(a,'40'x) || ,                   
  3010.                                '42'x   || bitor(c,'40'x)                        
  3011.                                                                                 
  3012. :READ  GOPCLIGV REXX     A1 TMP200 12/27/92 05:30:06                            
  3013. /*                                                                              
  3014.  *        Name: GOPCLIGV REXX                                                   
  3015.  *              VM TCP/IP Network GOPHER Client graphics viewer                 
  3016.  *              This file is part of CMS Gopher and not part of VMGIF.          
  3017.  *      Author: Rick Troth, Rice University, Information Systems                
  3018.  *        Date: 1992-Dec-23                                                     
  3019.  *                                                                              
  3020.  *        Note: the first record must be at least long enough                   
  3021.  *              to identify the graphics format (magic number)                  
  3022.  */                                                                             
  3023.                                                                                 
  3024. /*                                                                              
  3025.  *      Copyright 1992 Richard M. Troth.   This software was developed          
  3026.  *      with resources provided by Rice University and is intended              
  3027.  *      to serve Rice's user community.   Rice has benefitted greatly           
  3028.  *      from the free distribution of software,  therefore distribution         
  3029.  *      of unmodified copies of this material is not restricted.                
  3030.  *      You may change your own copy as needed.   Neither Rice                  
  3031.  *      University nor any of its employees or students shall be held           
  3032.  *      liable for damages resulting from the use of this software.             
  3033.  */                                                                             
  3034.                                                                                 
  3035. /*  Trace "OFF"  */                                                             
  3036.                                                                                 
  3037. 'PEEKTO RECORD'                                                                 
  3038. Select                                                                          
  3039.     When Left(record,5) = '4749463837'x Then Signal GIF                         
  3040.     Otherwise 'OUTPUT' "unknown graphics format"                                
  3041.     End  /*  Select  */                                                         
  3042.                                                                                 
  3043. Exit rc * (rc ^= 12)                                                            
  3044.                                                                                 
  3045.                                                                                 
  3046.                                                                                 
  3047. /* ------------------------------------------------------------------ */        
  3048. GIF:                                                                            
  3049.                                                                                 
  3050. /*  verify that we have the VMGIF disk accessed  */                             
  3051. 'CALLPIPE CMS STATE VMGIF MODULE * | *:'                                        
  3052. If rc ^= 0 Then Exit rc                                                         
  3053.                                                                                 
  3054. /*  try to stash the input stream in a temp file  */                            
  3055. 'CALLPIPE *: | > TEMP#GIF GIF A3'                                               
  3056. If rc ^= 0 Then Do                                                              
  3057.     grc = rc                                                                    
  3058.     'CALLPIPE COMMAND ERASE TEMP#GIF GIF A'                                     
  3059.     Exit grc                                                                    
  3060.     End  /*  If  ..  Do  */                                                     
  3061.                                                                                 
  3062. /*  ensure that the right libraries are GLOBALed  */                            
  3063. /*  (I loathe doing this)  */                                                   
  3064. 'CALLPIPE COMMAND QUERY TXTLIB' ,                                               
  3065.     '| STRIP LEADING STRING /TXTLIB   = / | JOIN * | VAR TXTLIB'                
  3066. Upper txtlib;   If Strip(txtlib) = "NONE" Then txtlib = ""                      
  3067. 'CALLPIPE COMMAND GLOBAL TXTLIB ADMPLIB ADMGLIB' txtlib                         
  3068.                                                                                 
  3069. /*  now run VMGIF  */                                                           
  3070. 'CALLPIPE CMS VMGIF -em5 TEMP#GIF | *:'; grc = rc                               
  3071.                                                                                 
  3072. /*  restore GLOBALed libraries  */                                              
  3073. 'CALLPIPE COMMAND GLOBAL TXTLIB' txtlib                                         
  3074.                                                                                 
  3075. Exit grc                                                                        
  3076.                                                                                 
  3077. :READ  GOPCLIFI EXEC     A1 TMP200 01/15/93 12:03:27                            
  3078. /*                                                                              
  3079.  *        Name: GOPCLIFI EXEC (function)                                        
  3080.  *              returns a CMS fileid from a gopher path                         
  3081.  *      Author: Rick Troth, Rice University, Information Systems                
  3082.  *        Date: 1992-Dec-10, 1993-Jan-15                                        
  3083.  *                                                                              
  3084.  *              This file is part of CMS Gopher.                                
  3085.  */                                                                             
  3086.                                                                                 
  3087. Parse Source . call . . . arg0 .                                                
  3088. If call ^= "FUNCTION" Then Do                                                   
  3089.     Say "Usage:" arg0 || "()"                                                   
  3090.     Exit                                                                        
  3091.     End                                                                         
  3092.                                                                                 
  3093. Parse Arg path                                                                  
  3094. Parse Value Reverse(path) With name '/' path                                    
  3095. Parse Value Reverse(name) With name ',' . ';' vers                              
  3096.                                                                                 
  3097. /*  input/output tables are built piecemeal to circumvent     *                 
  3098.  *  the 500 byte clause limit in older interpreters           */                
  3099. i   =    '000102030405060708090A0B0C0D0E0F'x || ,                               
  3100.          '101112131415161718191A1B1C1D1E1F'x || ,                               
  3101.          '202122232425262728292A2B2C2D2E2F'x || ,                               
  3102.          '303132333435363738393A3B3C3D3E3F'x                                    
  3103.                                                                                 
  3104. i = i || '404142434445464748494A4B4C4D4E4F'x || ,                               
  3105.          '505152535455565758595A5B5C5D5E5F'x || ,                               
  3106.          '606162636465666768696A6B6C6D6E6F'x || ,                               
  3107.          '707172737475767778797A7B7C7D7E7F'x                                    
  3108.                                                                                 
  3109. i = i || '808182838485868788898A8B8C8D8E8F'x || ,                               
  3110.          '909192939495969798999A9B9C9D9E9F'x || ,                               
  3111.          'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'x || ,                               
  3112.          'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'x                                    
  3113.                                                                                 
  3114. i = i || 'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'x || ,                               
  3115.          'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'x || ,                               
  3116.          'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'x || ,                               
  3117.          'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'x                                    
  3118.                                                                                 
  3119. o   =    '40404040404040404040404040404040'x || ,                               
  3120.          '40404040404040404040404040404040'x || ,                               
  3121.          '40404040404040404040404040404040'x || ,                               
  3122.          '40404040404040404040404040404040'x                                    
  3123.                                                                                 
  3124. o = o || '407C7C7C7C7C7C7C7C7C7C407C7C4E7C'x || ,                               
  3125.          '7C7C7C7C7C7C7C7C7C7C7C5B7C7C7C7C'x || ,                               
  3126.          '607C7C7C7C7C7C7C7C7C7C7C6C6D7C7C'x || ,                               
  3127.          '7C7C7C7C7C7C7C7C7C7C7A7B7C7C7C7C'x                                    
  3128.                                                                                 
  3129. o = o || '7CC1C2C3C4C5C6C7C8C97C7C7C7C7C7C'x || ,                               
  3130.          '7CD1D2D3D4D5D6D7D8D97C7C7C7C7C7C'x || ,                               
  3131.          '7C7CE2E3E4E5E6E7E8E97C7C7C7C7C7C'x || ,                               
  3132.          '7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C'x                                    
  3133.                                                                                 
  3134. o = o || '7CC1C2C3C4C5C6C7C8C97C7C7C7C7C7C'x || ,                               
  3135.          '7CD1D2D3D4D5D6D7D8D97C7C7C7C7C7C'x || ,                               
  3136.          '7C7CE2E3E4E5E6E7E8E97C7C7C7C7C7C'x || ,                               
  3137.          'F0F1F2F3F4F5F6F7F8F97C7C7C7C7C7C'x                                    
  3138.                                                                                 
  3139. Parse Upper Value Translate(name,o,i) With fn ft .                              
  3140. If fn = "" Then fn = "VMGOPHER"                                                 
  3141. If ft = "" Then ft = "DOCUMENT"                                                 
  3142. Return fn ft                                                                    
  3143.                                                                                 
  3144. :READ  GVM      EXEC     A1 TMP200 04/18/92 18:08:27                            
  3145. /*                                                                              
  3146.  *        Name: GVM EXEC                                                        
  3147.  *              for the DIALed GOPHER service virtual machine                   
  3148.  *              (not to be confused with GOPHERD service machine)               
  3149.  *      Author: Rick Troth, Rice Univ, I/S VM Systems Support                   
  3150.  *        Date: 1992-Mar-06, and prior                                          
  3151.  *                                                                              
  3152.  *        Note:                                                                 
  3153.  *              This EXEC has been tested with VM/SP R5.                        
  3154.  *              It is not guaranteed to work with anything else,                
  3155.  *              and probably  *will not*  work with VM/XA and ESA.              
  3156.  *                                                                              
  3157.  *              Similarity between the names PVM and GVM is intentional.        
  3158.  */                                                                             
  3159.                                                                                 
  3160. host = "localhost"                                                              
  3161. port = 70                                                                       
  3162. tube = 420                                                                      
  3163.                                                                                 
  3164. Address "COMMAND"                                                               
  3165.                                                                                 
  3166. /* Find my VMBLOK */                                                            
  3167. Parse Value Diag(08,'QUERY USERID') With userid . '15'x .                       
  3168. 'CP QUERY USERID'                                                               
  3169. Parse Value Diag(08,'LOCATE' userid) With . . vmbaddr . '15'x .                 
  3170. 'CP LOCATE' userid                                                              
  3171. If rc ^= 0 Then Exit rc                                                         
  3172. vmbaddr = strip(vmbaddr)                                                        
  3173.                                                                                 
  3174. 'CP DEFINE GRAF' tube                                                           
  3175. /* Trap I/O traces and wait for someone to DIAL */                              
  3176. 'IUCVTRAP ON ALL'                                                               
  3177. 'CP SET CPCONIO IUCV'                                                           
  3178. 'CP TRACE I/O RUN'                                                              
  3179. Do Forever      /* or at least until we get DIALed to */                        
  3180.     'IUCVTRAP GRAB (WAIT'                                                       
  3181.     Parse Pull . "I/O" iodevice .                                               
  3182.     If x2d(iodevice) = x2d(tube) Then Leave                                     
  3183.     End /* Do While */                                                          
  3184. 'CP TRACE END'                                                                  
  3185. 'CP SET CPCONIO OFF'                                                            
  3186. 'IUCVTRAP OFF'                                                                  
  3187.                                                                                 
  3188. Do i = 0 to 99                                                                  
  3189.     slaveid = "GOPHER" || Right(i,2,"0")                                        
  3190.     Parse Value Diagrc(08,'QUERY USER' slaveid),                                
  3191.         With 1 rc 10 . 17 rs '15'x .                                            
  3192.     If rc = 45 Then Leave                                                       
  3193.     End                                                                         
  3194. /* Change my userid to slaveid */                                               
  3195. 'CP STCP' d2x(x2d(vmbaddr)+272) c2x(left(slaveid,4)) c2x(right(slaveid,4))      
  3196.                                                                                 
  3197. /* Now fire-up another server */                                                
  3198. 'CP AUTOLOG' userid 'ALL'                                                       
  3199.                                                                                 
  3200. Parse Value Diag(08,'QUERY VIRTUAL' tube) With . . "ON" . graf '15'x .          
  3201.                                                                                 
  3202. 'EXEC GOPHER' host port '(TUBE' tube                                            
  3203. Say "GOPHER returned" rc                                                        
  3204.                                                                                 
  3205. 'CP DETACH' tube                                                                
  3206. /* 'CP HOST RESET' graf 'HOLD' */                                               
  3207. 'CP SLEEP 1 SEC'                                                                
  3208. Say 'CP DISABLE' graf                                                           
  3209. 'CP DISABLE' graf                                                               
  3210. 'CP SLEEP 1 SEC'                                                                
  3211. Say 'CP ENABLE' graf                                                            
  3212. 'CP ENABLE' graf                                                                
  3213. 'CP LOGOFF'                                                                     
  3214.                                                                                 
  3215. /* The TRACE string we're looking for is:                             *         
  3216.  * "*** EF8818 I/O   0420 ==> EF0C40  CSW 0400"                       */        
  3217. :READ  GVM      DIRECT   A1 TMP200 01/06/93 14:06:49                            
  3218. USER     GVM      pppppppp 2M       4M       ABCDEFG                    GVM00010
  3219. *                                                                       GVM00020
  3220. * This defines virtual machine GVM. Similarity in name to PVM           GVM00030
  3221. * is intentional. What you do is "DIAL GVM" from the VM logo,           GVM00040
  3222. * and GVM renames itself to one of GOPHER00 thru GOPHER09 (or more)     GVM00050
  3223. * and then runs GOPHER (GOPCLI) in "dialed mode".                       GVM00060
  3224. *                                                                       GVM00070
  3225.  INCLUDE  CMS                                                           GVM00080
  3226. *:name.DIALed Gopher service virtual machine :list.GOPHERD              GVM00090
  3227. * (at Rice, we extract records begining with  "*:"  nightly from        GVM00100
  3228. * CP Directory to create a  <node> NAMES  file on the public X disk)    GVM00110
  3229.  ACCOUNT  aaaaaaaa dddd                                                 GVM00120
  3230.  ACIGROUP gggggggg                                                      GVM00130
  3231.  LINK     GOPHERD   191      191     RR                                 GVM00140
  3232. *                                                                       GVM00150
  3233. USER     GOPHER00 NOLOG                                                 GVM00160
  3234. USER     GOPHER01 NOLOG                                                 GVM00170
  3235. USER     GOPHER02 NOLOG                                                 GVM00180
  3236. USER     GOPHER03 NOLOG                                                 GVM00190
  3237. USER     GOPHER04 NOLOG                                                 GVM00200
  3238. USER     GOPHER05 NOLOG                                                 GVM00210
  3239. USER     GOPHER06 NOLOG                                                 GVM00220
  3240. USER     GOPHER07 NOLOG                                                 GVM00230
  3241. USER     GOPHER08 NOLOG                                                 GVM00240
  3242. USER     GOPHER09 NOLOG                                                 GVM00250
  3243. *                                                                       GVM00260
  3244. :READ  GOPHERD  EXEC     A1 TMP200 01/20/93 18:48:43                            
  3245. /*                                                                    *         
  3246.  *        Name: PROFILE/GOPHPROF/GOPHERD EXEC                         *         
  3247.  *              initialization for the GopherD service virt machine   *         
  3248.  *      Author: Rick Troth, Rice University, Information Systems      *         
  3249.  *        Date: 1993-Jan-20                                           *         
  3250.  *                                                                    */        
  3251.                                                                                 
  3252. Address "COMMAND"                                                               
  3253.                                                                                 
  3254. /*  do any LINK and ACCESSes you need  */                                       
  3255.                                                                                 
  3256. 'EXEC GOPSRV'                                                                   
  3257. Exit rc                                                                         
  3258.                                                                                 
  3259. :READ  GOPHERD  CONFIG   A1 TMP200 01/20/93 18:34:51                            
  3260. *                                                                               
  3261. *         Name: GOPHERD CONFIG                                                  
  3262. *               CMS Gopher Server 2.4 configuration file                        
  3263. *       Author: Rick Troth, Rice University, Information Systems                
  3264. *         Date: 1993-Jan-18                                                     
  3265. *                                                                               
  3266. *      Changes: -none-                                                          
  3267. *                                                                               
  3268. * send logging information to the console                                       
  3269. *   and then also to the printer                                                
  3270. LOGPIPE=CONSOLE | SPEC .09. X2C 1 1-* NEXT | URO 00E                            
  3271. *                                                                               
  3272. :READ  GOPSRV   EXEC     A1 TMP200 01/22/93 14:25:57                            
  3273. /*                                                                              
  3274.  *        Name: GOPSRV EXEC                                                     
  3275.  *              A CMS-based Gopher Server                                       
  3276.  *              Based on the original, GOPHERD EXEC, from 2.3.                  
  3277.  *      Author: Rick Troth, Rice University, Information Systems                
  3278.  *        Date: 1992-Apr-21, Aug-07, Oct-14, Dec-11, 1993-Jan-15                
  3279.  */                                                                             
  3280.                                                                                 
  3281. /*                                                                              
  3282.  *      Copyright 1993 Richard M. Troth.   This software was developed          
  3283.  *      with resources provided by Rice University and is intended              
  3284.  *      to serve Rice's user community.   Rice has benefitted greatly           
  3285.  *      from the free distribution of software,  therefore distribution         
  3286.  *      of unmodified copies of this material is not restricted.                
  3287.  *      You may change your own copy as needed.   Neither Rice                  
  3288.  *      University nor any of its employees or students shall be held           
  3289.  *      liable for damages resulting from the use of this software.             
  3290.  */                                                                             
  3291.                                                                                 
  3292. /*                                                                              
  3293.  *       Calls:                                                                 
  3294.  *              GOPSRVLS REXX     -- to read files and menus                    
  3295.  *              GOPSRVRP REXX     -- to resolve gopher paths                    
  3296.  *              GOPSRVMB REXX     -- to build menus for the client              
  3297.  *                                                                              
  3298.  *        Note: this program does *not* use RXSOCKET's translation              
  3299.  *              option.   Translation between ASCII and EBCDIC                  
  3300.  *              is determined by the type of file requested.                    
  3301.  */                                                                             
  3302.                                                                                 
  3303. progid = "CMS Gopher 2.4.0 server"                                              
  3304. gopher = "Gopher"                                                               
  3305. timeout = 5                                                                     
  3306.                                                                                 
  3307. Parse Source . . . . . arg0 .                                                   
  3308. argo = arg0 || ':'                                                              
  3309. Parse Upper Arg root port . '(' . ')' .                                         
  3310.                                                                                 
  3311. Address "COMMAND"                                                               
  3312.                                                                                 
  3313. 'SET LANGUAGE (ADD GOP USER'                                                    
  3314.                                                                                 
  3315. host = "localhost"      /*  this will be reset to the actual name of  *         
  3316.                          *  this host after RXSOCKET is initialized.  */        
  3317.                                                                                 
  3318.     stdin  = 0                                                                  
  3319.     stdout = 1                                                                  
  3320.     stderr = 2                                                                  
  3321.                                                                                 
  3322. Say argo progid "starting"                                                      
  3323.                                                                                 
  3324. logpipe = "CONSOLE"                                                             
  3325. _root = Userid()                                                                
  3326. _port = 70                                                                      
  3327. 'PIPE < GOPHERD CONFIG * | STEM CONFIG.'                                        
  3328. If rc = 0 Then                                                                  
  3329. Do i = 1 to config.0                                                            
  3330.     If Left(config.i,1) = '*' Then Iterate                                      
  3331.     If Left(config.i,1) = '#' Then Iterate                                      
  3332.     If Index(config.i,'=') = 0 Then Iterate                                     
  3333.     Parse Var config.i var '=' val                                              
  3334.     Upper var                                                                   
  3335.     Select  /*  var  */                                                         
  3336.         When  Abbrev("LOGPIPE",var,3)   Then  logpipe = val                     
  3337.         When  Abbrev("ROOT",var,4)      Then  _root = val                       
  3338.         When  Abbrev("PORT",var,4)      Then  _port = val                       
  3339.         Otherwise 'XMITMSG 2 VAR (ERRMSG'                                       
  3340.         End  /*  Select  var  */                                                
  3341.     End  /*  Do  For  */                                                        
  3342.                                                                                 
  3343. If root = "" Then root = _root                                                  
  3344. If port = "" Then port = _port                                                  
  3345.                                                                                 
  3346. If ^Datatype(port,'N') Then Do                                                  
  3347.     /*  "Gopher TCP/IP service port must be numeric."  */                       
  3348.     'XMITMSG 126 (APPLID GOP CALLER SRV ERRMSG'                                 
  3349.     Exit 24                                                                     
  3350.     End  /*  If  ..  Do  */                                                     
  3351.                                                                                 
  3352. /*                                                                              
  3353.  *   Initialize RXSOCKET                                                        
  3354.  */                                                                             
  3355. maxdesc = Socket('Initialize', gopher)                                          
  3356. If maxdesc = "-1" Then Do                                                       
  3357.     Say argo tcperror()                                                         
  3358.     Exit -1                                                                     
  3359.     End  /*  If  ..  Do  */                                                     
  3360. Say argo "RXSOCKET Initialized for" maxdesc "descriptors"                       
  3361.                                                                                 
  3362.                                                                                 
  3363. /*                                                                              
  3364.  *   Request the name of this host                                              
  3365.  */                                                                             
  3366. rc = Socket('GetHostName', 'HOST')                                              
  3367. If rc = "-1" Then Do                                                            
  3368.     Say argo tcperror()                                                         
  3369.     Exit -1                                                                     
  3370.     End  /*  If  ..  Do  */                                                     
  3371. Say argo "LocalHost =" host                                                     
  3372.                                                                                 
  3373.                                                                                 
  3374. /*                                                                              
  3375.  *   Request a new socket descriptor (TCP protocol)                             
  3376.  */                                                                             
  3377. socket = Socket('Socket', 'AF_INET', 'Sock_Stream')                             
  3378. If socket = "-1" Then Do                                                        
  3379.     Say argo tcperror()                                                         
  3380.     Exit -1                                                                     
  3381.     End  /*  If  ..  Do  */                                                     
  3382. Say argo "Primary socket =" socket                                              
  3383.                                                                                 
  3384.                                                                                 
  3385. /*                                                                              
  3386.  *   Set this socket to non-blocking mode                                       
  3387.  */                                                                             
  3388. rc = Socket('Ioctl', socket, 'FIONBIO', 1)                                      
  3389. If rc = "-1" Then                                                               
  3390.     Say argo tcperror()                                                         
  3391.                                                                                 
  3392.                                                                                 
  3393. /*                                                                              
  3394.  *                                                                              
  3395.  */                                                                             
  3396. name = AF_INET || Htons(port)                                                   
  3397.                                                                                 
  3398. rc = Socket('Bind', socket, name)                                               
  3399. If rc = "-1" Then Do                                                            
  3400.     Say argo tcperror()                                                         
  3401.     Exit -1                                                                     
  3402.     End  /*  If  ..  Do  */                                                     
  3403. Say argo "Bound to port" port                                                   
  3404.                                                                                 
  3405.                                                                                 
  3406. /*                                                                              
  3407.  *                                                                              
  3408.  */                                                                             
  3409. rc = Socket('Listen', socket, maxdesc)                                          
  3410. If rc = "-1" Then Do                                                            
  3411.     Say argo tcperror()                                                         
  3412.     Exit -1                                                                     
  3413.     End  /*  If  ..  Do  */                                                     
  3414. /*  Say argo "Listening ..."  */                                                
  3415.                                                                                 
  3416. /*  UNIX and VMS style logging:  */                                             
  3417. Parse Value Date('S') With 1 yy 5 mm 7 dd 9 .                                   
  3418. day = Left(Date('W'),3)                                                         
  3419. mon = Left(Date('M'),3)                                                         
  3420. time = Time()                                                                   
  3421. userid = Userid()                                                               
  3422. /*  "Starting gopher daemon" Userid()  */                                       
  3423. 'PIPE COMMAND XMITMSG 120 DAY MON DD TIME YY HOST USERID' ,                     
  3424.         '(APPLID GOP CALLER SRV ERRMSG |' logpipe                               
  3425.                                                                                 
  3426. Say argo progid "waiting for a connection"                                      
  3427.                                                                                 
  3428. 'GLOBALV SELECT GOPHERD PUT HOST PORT ROOT'                                     
  3429.                                                                                 
  3430. Do Forever                                                                      
  3431.                                                                                 
  3432.     rc = FD_ZERO('readmask')            /* must be reset each time */           
  3433.     rc = FD_SET(socket, 'readmask')                                             
  3434.     rc = FD_SET(stdin, 'readmask')                                              
  3435.                                                                                 
  3436.     Say "*"     /* waiting */                                                   
  3437.     rc = Socket('Select', socket + 1, 'readmask', 0, 0, 0)                      
  3438.     If rc = "-1" Then Do                                                        
  3439.         Say argo tcperror()                                                     
  3440.         Leave                                                                   
  3441.         End  /*  If  ..  Do  */                                                 
  3442.                                                                                 
  3443.     If FD_ISSET(stdin, 'readmask') = 1 Then Leave                               
  3444.     If FD_ISSET(socket, 'readmask') ^= 1 Then Iterate                           
  3445.                                                                                 
  3446.     /*                                                                          
  3447.      *                                                                          
  3448.      */                                                                         
  3449.     ns = Socket('Accept', socket, 'CLIENT')                                     
  3450.     If ns = "-1" Then Do                                                        
  3451.         Say argo tcperror()                                                     
  3452.         Leave                                                                   
  3453.         End  /*  If  ..  Do  */                                                 
  3454.                                                                                 
  3455.     Say argo "Accepted" ns "at" Time() "client" c2x(client)                     
  3456.     Parse Var client . 5 r1 +1 r2 +1 r3 +1 r4 +1 .                              
  3457.     cipa = c2d(r1) || "." || c2d(r2) || "." || ,                                
  3458.            c2d(r3) || "." || c2d(r4)                                            
  3459.     /*  Say argo "Client's IP address is" cipa  */                              
  3460.                                                                                 
  3461.     /*  UNIX and VMS style logging:  */                                         
  3462.     Parse Value Date('S') With 1 yyyy 5 mm 7 dd 9 .                             
  3463.     day = Left(Date('W'),3)                                                     
  3464.     mon = Left(Date('M'),3)                                                     
  3465.     time = Time()                                                               
  3466.                                                                                 
  3467.     /*                                                                          
  3468.      *   Loop, reading the query line from the client.                          
  3469.      */                                                                         
  3470.     path = ""                                                                   
  3471.     Do Forever                                                                  
  3472.                                                                                 
  3473.         rc = FD_ZERO('readmask')        /* must be reset each time */           
  3474.         rc = FD_SET(ns, 'readmask')                                             
  3475.                                                                                 
  3476.         rc = Socket('Select', ns + 1, 'readmask', 0, 0, timeout)                
  3477.         If rc = "-1" Then Do                                                    
  3478.             Say argo tcperror()                                                 
  3479.             Exit -1                                                             
  3480.             End  /*  If  ..  Do  */                                             
  3481.                                                                                 
  3482.         If FD_ISSET(ns, 'readmask') ^= 1 Then Leave                             
  3483.                                                                                 
  3484.         pack = ""                                                               
  3485.         bytes_in = Socket('Read', ns, 'PACK')                                   
  3486.         If bytes_in = "-1" Then                                                 
  3487.             Say argo tcperror()                                                 
  3488.         If bytes_in < 1 Then Leave                                              
  3489.         If Index(pack,'0A'x) > 0 Then Leave /* ASCII LF */                      
  3490.         If Index(pack,'0D'x) > 0 Then Leave /* ASCII CR */                      
  3491.         path = path || pack                                                     
  3492.     End                                                                         
  3493.     path = path || pack                                                         
  3494.                                                                                 
  3495.     Parse Var path path '0A'x .     /* ASCII LF */                              
  3496.     Parse Var path path '0D'x .     /* ASCII CR */                              
  3497.     'PIPE VAR PATH | A2E | VAR PATH'                                            
  3498.                                                                                 
  3499.     /*  refresh disk access  (same procedure as used by GONE EXEC)  */          
  3500.     'PIPE CMS QUERY DISK | DROP | STEM STEM.'                                   
  3501.     Do i = 1 to stem.0                                                          
  3502.         Parse Var stem.i . 8 va 12 fm .                                         
  3503.         If Left(va,3) = "DIR" Then Iterate                                      
  3504.         'DISKWRIT' Left(fm,1)                                                   
  3505.         If rc = 1 Then 'ACCESS' va fm                                           
  3506.         End  /*  Do  For  */                                                    
  3507.                                                                                 
  3508.     client = cipa                                                               
  3509.     'GLOBALV SELECT GOPHERD PUT CLIENT'                                         
  3510.                                                                                 
  3511.                                                                                 
  3512. Parse Var path path '05'x parm                                                  
  3513. Say argo "Requesting:" path                                                     
  3514. If parm ^= "" Then Say argo "+ Parms:" parm                                     
  3515.                                                                                 
  3516. Select  /*  type  */                                                            
  3517.                                                                                 
  3518.     When path = "" Then Do                                                      
  3519.         type = '1'                                                              
  3520.         logmsg = 121    /*  "Root Connection"  */                               
  3521.         End  /*  When  ..  Do  */                                               
  3522.                                                                                 
  3523.     When Left(path,1) = '1' Then Do                                             
  3524.         Parse Var path 1 type 2 path                                            
  3525.         logmsg = 122    /*  "retrieved directory" path  */                      
  3526.         End  /*  When  ..  Do  */                                               
  3527.                                                                                 
  3528.     When Left(path,1) = '7' Then Do                                             
  3529.         Parse Var path 1 type 2 path                                            
  3530.         logmsg = 125    /*  "searched directory" path  */                       
  3531.         End  /*  When  ..  Do  */                                               
  3532.                                                                                 
  3533.     When Left(path,1) = '/' Then Do                                             
  3534.         type = '0'                                                              
  3535.         logmsg = 123    /*  "retrieved file" path  */                           
  3536.         End  /*  When  ..  Do  */                                               
  3537.                                                                                 
  3538.     Otherwise Do                                                                
  3539.         Parse Var path 1 type 2 path                                            
  3540.         logmsg = 123    /*  "retrieved file" path  */                           
  3541.         End  /*  Otherwise  Do  */                                              
  3542.                                                                                 
  3543.     End  /*  Select  type  */                                                   
  3544.                                                                                 
  3545. 'GLOBALV SELECT GOPHERD PUT PATH PARM'                                          
  3546. 'GLOBALV SELECT GOPHERD SET MENU'                                               
  3547.                                                                                 
  3548. Select  /*  type  */                                                            
  3549.                                                                                 
  3550.     When type = "0" Then        /* plain text file */                           
  3551.         pipe = 'APPEND LITERAL .' || ,                                          
  3552.             '| E2A | SPEC 1-* 1 x0D0A NEXT'                                     
  3553.                                                                                 
  3554.     When type = "1" Then        /* menu */                                      
  3555.         pipe = 'GOPSRVMB | APPEND LITERAL .' || ,                               
  3556.             '| E2A | SPEC 1-* 1 x0D0A NEXT'                                     
  3557.                                                                                 
  3558.     When type = "7" Then        /* menu with search */                          
  3559.         pipe = 'GOPSRVYS' parm '| GOPSRVMB | APPEND LITERAL .' || ,             
  3560.             '| E2A | SPEC 1-* 1 x0D0A NEXT'                                     
  3561.                                                                                 
  3562.     When type = "9" | ,         /* binary */                                    
  3563.          type = "4" | ,         /* Mac file, send as binary */                  
  3564.          type = "5" | ,         /* PC file, send as binary */                   
  3565.          type = "I" | ,         /* send pictures as binary */                   
  3566.          type = "s" Then        /* sound, send as binary */                     
  3567. pipe = 'FBLOCK 8192'    /*  default processing  */                              
  3568.                                                                                 
  3569.     When type = "p" Then        /* PostScript */                                
  3570.         pipe = 'E2A | SPEC 1-* 1 x0D0A NEXT'                                    
  3571.                                                                                 
  3572.     When type = "r" | ,         /* record oriented file */                      
  3573.          type = "v" Then        /* var-length records */                        
  3574.         pipe = 'BLOCK 65531 CMS |' pipe                                         
  3575.                                                                                 
  3576.     Otherwise                   /* send it as binary */                         
  3577. pipe = 'FBLOCK 8192'    /*  default processing  */                              
  3578.                                                                                 
  3579.     End  /*  Select  type  */                                                   
  3580.                                                                                 
  3581.     'PIPE GOPSRVLS' root '| GOPSRVRP' path ,                                    
  3582.             '|' pipe '| FBLOCK 8192 | STEM STEM.'                               
  3583.                                                                                 
  3584. /*  If rc ^= 0 Then logrqest = logrqest "(rc=" || rc || ")"  */                 
  3585.                                                                                 
  3586. 'PIPE COMMAND XMITMSG' logmsg 'DAY MON DD TIME YY CLIENT PATH' ,                
  3587.         '(APPLID GOP CALLER SRV ERRMSG |' logpipe                               
  3588.                                                                                 
  3589.                                                                                 
  3590.     Say argo stem.0 "blocks to send"                                            
  3591.     /*                                                                          
  3592.      *   Send the response to our client                                        
  3593.      */                                                                         
  3594.     Do i = 1 to stem.0                                                          
  3595.         bytes_out = Socket('Write', ns, stem.i)                                 
  3596.         If bytes_out = "-1" Then Do                                             
  3597.             Say argo tcperror()                                                 
  3598.             Leave                                                               
  3599.             End  /*  If  ..  Do  */                                             
  3600.         End  /*  Do  For  */                                                    
  3601.                                                                                 
  3602.                                                                                 
  3603.     /*                                                                          
  3604.      *   All done, relinquish our socket descriptor                             
  3605.      */                                                                         
  3606.     rc = Socket('Close', ns)                                                    
  3607.     If rc = "-1" Then Do                                                        
  3608.         Say argo tcperror()                                                     
  3609.         Leave                                                                   
  3610.         End  /*  If  ..  Do  */                                                 
  3611.     Say argo "Closed" ns "at" Time()                                            
  3612.                                                                                 
  3613.                                                                                 
  3614.     End  /*  Do  Forever  */                                                    
  3615.                                                                                 
  3616.                                                                                 
  3617. /*                                                                              
  3618.  *   Tell RXSOCKET that we are done with this IUCV path                         
  3619.  */                                                                             
  3620. rc = Socket('Terminate')                                                        
  3621. If rc = "-1" Then Do                                                            
  3622.     Say argo tcperror()                                                         
  3623.     End  /*  If  ..  Do  */                                                     
  3624.                                                                                 
  3625.                                                                                 
  3626. Exit                                                                            
  3627.                                                                                 
  3628. :READ  GOPSRVLS REXX     A1 TMP200 01/20/93 18:44:35                            
  3629. /*                                                                              
  3630.  *        Name: GOPSRVLS REXX                                                   
  3631.  *              list a file or directory, feeding to the next stage             
  3632.  *      Author: Rick Troth, Rice University, Information Systems                
  3633.  *        Date: 1993-Jan-15, 19                                                 
  3634.  */                                                                             
  3635.                                                                                 
  3636. /*                                                                              
  3637.  *      Copyright 1993 Richard M. Troth.   This software was developed          
  3638.  *      with resources provided by Rice University and is intended              
  3639.  *      to serve Rice's user community.   Rice has benefitted greatly           
  3640.  *      from the free distribution of software,  therefore distribution         
  3641.  *      of unmodified copies of this material is not restricted.                
  3642.  *      You may change your own copy as needed.   Neither Rice                  
  3643.  *      University nor any of its employees or students shall be held           
  3644.  *      liable for damages resulting from the use of this software.             
  3645.  */                                                                             
  3646.                                                                                 
  3647. Parse Source . . arg0 .                                                         
  3648. Parse Upper Arg fn ft fm . '(' . ')' .                                          
  3649. If fn = "" Then fn = '*'                                                        
  3650. If ft = "" Then ft = '*'                                                        
  3651. If ft = "FILELIST" & Index(fn,'*') = 0 Then ft = "*"                            
  3652. If fm = "" Then fm = '*'                                                        
  3653.                                                                                 
  3654. Parse Arg string                                                                
  3655. Say arg0 || ':' string                                                          
  3656.                                                                                 
  3657. Address "COMMAND" 'GLOBALV SELECT GOPHERD GET MENU NICK CLIENT'                 
  3658.                                                                                 
  3659. If menu ^= "" Then Do                                                           
  3660.                                                                                 
  3661.                                                                                 
  3662.     Address "CMS" 'STATE' menu 'NAMES *'                                        
  3663.     If rc = 0 Then Do                                                           
  3664.                                                                                 
  3665.         If nick = "" Then nick = "*"                                            
  3666.                                                                                 
  3667.         'CALLPIPE COMMAND NAMEFIND :NICK' nick ':AUTH :PIPE' ,                  
  3668.                 '(FILE' menu '| VAR AUTH | DROP' ,                              
  3669.         '| CHANGE' '00'x || '&0' || '00'x || nick || '00'x ,                    
  3670.         '| CHANGE' '00'x || '&1' || '00'x ||  fn  || '00'x ,                    
  3671.         '| CHANGE' '00'x || '&2' || '00'x ||  ft  || '00'x ,                    
  3672.         '| CHANGE' '00'x || '&3' || '00'x ||  fm  || '00'x ,                    
  3673.         '| CHANGE' '00'x || '&4' || '00'x || menu || '00'x ,                    
  3674.                 '| VAR PIPE'                                                    
  3675.                                                                                 
  3676.         If rc = 32 Then                                                         
  3677.         'CALLPIPE COMMAND NAMEFIND :FN' fn ':FT' ft ':AUTH :PIPE' ,             
  3678.                 '(FILE' menu '| VAR AUTH | DROP' ,                              
  3679.         '| CHANGE' '00'x || '&0' || '00'x || nick || '00'x ,                    
  3680.         '| CHANGE' '00'x || '&1' || '00'x ||  fn  || '00'x ,                    
  3681.         '| CHANGE' '00'x || '&2' || '00'x ||  ft  || '00'x ,                    
  3682.         '| CHANGE' '00'x || '&3' || '00'x ||  fm  || '00'x ,                    
  3683.         '| CHANGE' '00'x || '&4' || '00'x || menu || '00'x ,                    
  3684.                 '| VAR PIPE'                                                    
  3685.                                                                                 
  3686.         If rc = 32 Then                                                         
  3687.         'CALLPIPE COMMAND NAMEFIND :NICK * :AUTH :PIPE' ,                       
  3688.                 '(FILE' menu '| VAR AUTH | DROP' ,                              
  3689.         '| CHANGE' '00'x || '&0' || '00'x || nick || '00'x ,                    
  3690.         '| CHANGE' '00'x || '&1' || '00'x ||  fn  || '00'x ,                    
  3691.         '| CHANGE' '00'x || '&2' || '00'x ||  ft  || '00'x ,                    
  3692.         '| CHANGE' '00'x || '&3' || '00'x ||  fm  || '00'x ,                    
  3693.         '| CHANGE' '00'x || '&4' || '00'x || menu || '00'x ,                    
  3694.                 '| VAR PIPE'                                                    
  3695.                                                                                 
  3696.         If rc = 0 Then Do                                                       
  3697.                                                                                 
  3698.             /*  if auth non-blank  */                                           
  3699.             If ^gopsrvau(client,auth) Then Do                                   
  3700.                 /*  "access restricted"  */                                     
  3701.                 'CALLPIPE COMMAND XMITMSG 2380' ,                               
  3702.                     '(CALLER GOP ERRMSG' ,                                      
  3703.                         '| SPEC /- / 1 1-* NEXT | *:'                           
  3704.                 Exit rc                                                         
  3705.                 End  /*  If  ..  Do  */                                         
  3706.                                                                                 
  3707.             If pipe ^= "" Then Do                                               
  3708.                 'CALLPIPE' pipe '| *:'                                          
  3709.                 Exit rc                                                         
  3710.                 End  /*  If  ..  Do  */                                         
  3711.                                                                                 
  3712.             End  /*  If  ..  Do  */                                             
  3713.                                                                                 
  3714.         End  /*  If  ..  Do  */                                                 
  3715.                                                                                 
  3716.     End  /*  If  ..  Do  */                                                     
  3717.                                                                                 
  3718. If ft = '*' Then Do                                                             
  3719.                                                                                 
  3720.     Address "CMS" 'STATE' fn 'NAMES *'                                          
  3721.     If rc = 0 Then Do                                                           
  3722.                                                                                 
  3723.         'CALLPIPE COMMAND NAMEFIND :NICK . :AUTH :PIPE' ,                       
  3724.                 '(FILE' fn '| VAR AUTH | DROP' ,                                
  3725.         '| CHANGE' '00'x || '&0' || '00'x || nick || '00'x ,                    
  3726.         '| CHANGE' '00'x || '&1' || '00'x ||  fn  || '00'x ,                    
  3727.         '| CHANGE' '00'x || '&2' || '00'x ||  ft  || '00'x ,                    
  3728.         '| CHANGE' '00'x || '&3' || '00'x ||  fm  || '00'x ,                    
  3729.         '| CHANGE' '00'x || '&4' || '00'x || menu || '00'x ,                    
  3730.                 '| VAR PIPE'                                                    
  3731.                                                                                 
  3732.         If rc = 0 Then Do                                                       
  3733.                                                                                 
  3734.             /*  if auth non-blank  */                                           
  3735.             If ^gopsrvau(client,auth) Then Do                                   
  3736.                 /*  "access restricted"  */                                     
  3737.                 'CALLPIPE COMMAND XMITMSG 2380' ,                               
  3738.                     '(CALLER GOP ERRMSG' ,                                      
  3739.                         '| SPEC /- / 1 1-* NEXT | *:'                           
  3740.                 Exit rc                                                         
  3741.                 End  /*  If  ..  Do  */                                         
  3742.                                                                                 
  3743.             If pipe ^= "" Then Do                                               
  3744.                 menu = fn                                                       
  3745.                 Address "COMMAND" 'GLOBALV SELECT GOPHERD PUT MENU'             
  3746.                 'CALLPIPE' pipe '| *:'                                          
  3747.                 Exit rc                                                         
  3748.                 End  /*  If  ..  Do  */                                         
  3749.                                                                                 
  3750.             End  /*  If  ..  Do  */                                             
  3751.                                                                                 
  3752.         End  /*  If  ..  Do  */                                                 
  3753.                                                                                 
  3754.     End  /*  If  ..  Do  */                                                     
  3755.                                                                                 
  3756. If Index(fn ft, '*') = 0 Then Do                                                
  3757.     Address "CMS" 'STATE' fn ft fm                                              
  3758.     If rc = 0 Then Do                                                           
  3759.         'CALLPIPE <' fn ft fm '| *:'                                            
  3760.         Exit rc                                                                 
  3761.         End                                                                     
  3762.     Exit rc                                                                     
  3763.     End                                                                         
  3764.                                                                                 
  3765. If Index(fn,'*') = 0 & ft = '*' Then Do                                         
  3766.                                                                                 
  3767.     Address "COMMAND" 'GLOBALV SELECT GOPHERD SET MENU' fn                      
  3768.                                                                                 
  3769.     Address "CMS" 'STATE' fn 'FILELIST' fm                                      
  3770.     If  rc = 0  Then Do     /*  menu is a FILELIST  */                          
  3771.         'CALLPIPE <' fn 'FILELIST' fm '| *:'                                    
  3772.         Exit rc                                                                 
  3773.         End  /*  If  ..  Do  */                                                 
  3774.                                                                                 
  3775.     If fm = '*' | fm = "" Then fm = 'A'                                         
  3776.     'CALLPIPE COMMAND ACCESS +' || fm || '.' || fn fm                           
  3777.     If rc = 0 Then Do                                                           
  3778.         /*  menu is an SFS sub-directory  */                                    
  3779.         'CALLPIPE' arg0 '* *' fm '| *:'                                         
  3780.         lrc = rc                                                                
  3781.         'CALLPIPE COMMAND ACCESS -' || fm fm                                    
  3782.         Exit lrc                                                                
  3783.         End  /*  If  ..  Do  */                                                 
  3784.     If rc = 28 | rc = 100 Then Exit rc                                          
  3785.     End                                                                         
  3786.                                                                                 
  3787. /*  shortcut for GOPSRVRP on LISTFILE not FILELIST  */                          
  3788. 'OUTPUT' " "                                                                    
  3789. If rc ^= 0 Then Exit rc * (rc ^= 12)                                            
  3790.                                                                                 
  3791. /*  list all files in this directory  */                                        
  3792. 'ADDPIPE COMMAND LISTFILE' fn ft fm '(ALLFILE ALLOC NOHEADER | *.INPUT:'        
  3793. If rc ^= 0 Then Do                                                              
  3794.     'CALLPIPE COMMAND LISTFILE' fn ft fm '(NOHEADER | *:'                       
  3795.     Exit rc                                                                     
  3796.     End  /*  If  ..  Do  */                                                     
  3797.                                                                                 
  3798. /*  give SFS directories a filetype '*'  */                                     
  3799. Do Forever                                                                      
  3800.                                                                                 
  3801.     'PEEKTO RECORD'                                                             
  3802.     If rc ^= 0 Then Leave                                                       
  3803.                                                                                 
  3804.     Parse Var record fn ft fm .                                                 
  3805.     If fm = "DIR" Then 'OUTPUT' "     " fn '*' ft                               
  3806.                   Else 'OUTPUT' "     " fn ft fm                                
  3807.                                                                                 
  3808.     'READTO'                                                                    
  3809.     If rc ^= 0 Then Leave                                                       
  3810.                                                                                 
  3811.     End  /*  If  ..  Do  Forever  */                                            
  3812.                                                                                 
  3813. Exit rc * (rc ^= 12)                                                            
  3814.                                                                                 
  3815. :READ  GOPSRVRP REXX     A1 TMP200 01/22/93 18:06:38                            
  3816. /*                                                                              
  3817.  *        Name: GOPSRVRP REXX                                                   
  3818.  *              resolve gopher paths (selector strings) recursively             
  3819.  *      Author: Rick Troth, Rice University, Information Systems                
  3820.  *        Date: 1993-Jan-15, 19                                                 
  3821.  *                                                                              
  3822.  *              This file is part of CMS Gopher.                                
  3823.  */                                                                             
  3824.                                                                                 
  3825. /*                                                                              
  3826.  *      Copyright 1993 Richard M. Troth.   This software was developed          
  3827.  *      with resources provided by Rice University and is intended              
  3828.  *      to serve Rice's user community.   Rice has benefitted greatly           
  3829.  *      from the free distribution of software,  therefore distribution         
  3830.  *      of unmodified copies of this material is not restricted.                
  3831.  *      You may change your own copy as needed.   Neither Rice                  
  3832.  *      University nor any of its employees or students shall be held           
  3833.  *      liable for damages resulting from the use of this software.             
  3834.  */                                                                             
  3835.                                                                                 
  3836. Parse Source . . arg0 .                                                         
  3837. Parse Arg nick '/' rest                                                         
  3838. nick = Strip(nick)                                                              
  3839. rest = Strip(rest)                                                              
  3840.                                                                                 
  3841. Do While nick = ""      /*  deal with null parts w/o recursion  */              
  3842.     If rest = "" Then Do; 'SHORT'; Exit rc; End                                 
  3843.     Parse Var rest nick '/' rest                                                
  3844.     End  /*  Do  While  */                                                      
  3845. /*                                                                              
  3846. If nick = "" Then Do    **  deal with null parts by recursion  **               
  3847.     If rest = "" Then 'SHORT'                                                   
  3848.                  Else 'CALLPIPE *: |' arg0 rest '| *:'                          
  3849.     Exit rc                                                                     
  3850.     End  **  If  ..  Do  **                                                     
  3851.  */                                                                             
  3852.                                                                                 
  3853. /*  look for the shortcut on pure LISTFILE ouptut  */                           
  3854. 'PEEKTO RECORD'                                                                 
  3855. If rc ^= 0 Then Exit rc * (rc ^= 12)                                            
  3856. If Strip(record) = "" Then Signal SHORTCUT                                      
  3857.                                                                                 
  3858. /*  part = nick;  Upper part  */                                                
  3859. Parse Upper Var nick part                                                       
  3860.                                                                                 
  3861. Do Forever                                                                      
  3862.                                                                                 
  3863.     'READTO RECORD'                                                             
  3864.     If rc ^= 0 Then Leave                                                       
  3865.     If Left(record,1) = '*' Then Iterate                                        
  3866.     If Left(record,1) ^= ' ' Then Leave         /*  short cut  */               
  3867.                                                                                 
  3868.     Parse Upper Var record fn ft fm fp '"' . "'" . '05'x .                      
  3869.     If Strip(fn) = "" Then Iterate                                              
  3870.                                                                                 
  3871.     If  fp = "" Then  Select  /*  ft  */                                        
  3872.         When  Index(fn,'*') > 0 Then    fp = fn || '.' || ft                    
  3873.         When  ft = ""   | ft = "*"  | ,                                         
  3874.               ft = "FILELIST"   Then    fp = fn                                 
  3875.         Otherwise                       fp = fn || '.' || ft                    
  3876.         End  /*  Select  ft  */                                                 
  3877.     If Strip(fp) ^= part Then Iterate                                           
  3878.                                                                                 
  3879. Say "GOPSRVRP: matched" fn ft fm fp                                             
  3880.     /*  found it!  */                                                           
  3881.     /*  Parse Arg nick '/' .  */                                                
  3882.     Address "COMMAND" 'GLOBALV SELECT GOPHERD PUT NICK'                         
  3883.     If rest = "" Then 'CALLPIPE GOPSRVLS' fn ft fm '| *:'                       
  3884.                  Else 'CALLPIPE GOPSRVLS' fn ft fm '|' arg0 rest '| *:'         
  3885.     /*  Leave  */  Exit rc                                                      
  3886.                                                                                 
  3887.     End                                                                         
  3888.                                                                                 
  3889. FALLOUT:                                                                        
  3890. Say "GOPSRVRP: didn't find a match for" nick                                    
  3891. /*  fallout;  we didn't find a match in this menu  */                           
  3892. /*  Parse Arg nick  */                                                          
  3893. nick = nick || '/' || rest                                                      
  3894. Address "COMMAND" 'GLOBALV SELECT GOPHERD PUT NICK'                             
  3895. 'CALLPIPE GOPSRVLS ? ? ? | *:'                                                  
  3896.                                                                                 
  3897. Exit rc                                                                         
  3898.                                                                                 
  3899. SHORTCUT:                                                                       
  3900. Parse Var                                                                       
  3901. Say "GOPSRVRP: shortcut to" fn ft fm fp                                         
  3902.     /*  found it!  */                                                           
  3903.     /*  Parse Arg nick '/' .  */                                                
  3904.     Address "COMMAND" 'GLOBALV SELECT GOPHERD PUT NICK'                         
  3905.     If rest = "" Then 'CALLPIPE GOPSRVLS' fn ft fm '| *:'                       
  3906.                  Else 'CALLPIPE GOPSRVLS' fn ft fm '|' arg0 rest '| *:'         
  3907.     /*  Leave  */  Exit rc                                                      
  3908.                                                                                 
  3909.                                                                                 
  3910. :READ  GOPSRVMB REXX     A1 TMP200 01/25/93 13:44:26                            
  3911. /*                                                                              
  3912.  *        Name: GOPSRVMB REXX                                                   
  3913.  *              CMS Gopher Server menu builder pipeline stage                   
  3914.  *              Based on the older GOPHERDM REXX stage from 2.3.                
  3915.  *      Author: Rick Troth, Rice University, Information Systems                
  3916.  *        Date: 1993-Jan-15                                                     
  3917.  */                                                                             
  3918.                                                                                 
  3919. /*                                                                              
  3920.  *      Copyright 1993 Richard M. Troth.   This software was developed          
  3921.  *      with resources provided by Rice University and is intended              
  3922.  *      to serve Rice's user community.   Rice has benefitted greatly           
  3923.  *      from the free distribution of software,  therefore distribution         
  3924.  *      of unmodified copies of this material is not restricted.                
  3925.  *      You may change your own copy as needed.   Neither Rice                  
  3926.  *      University nor any of its employees or students shall be held           
  3927.  *      liable for damages resulting from the use of this software.             
  3928.  */                                                                             
  3929.                                                                                 
  3930. uc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"                                               
  3931. lc = "abcdefghijklmnopqrstuvwxyz"                                               
  3932.                                                                                 
  3933. /*  sync with input  */                                                         
  3934. 'PEEKTO'                                                                        
  3935. If rc ^= 0 Then Exit rc * (rc ^= 12)                                            
  3936.                                                                                 
  3937. /*  experience shows that sometimes GLOBALV SELECT        *                     
  3938.  *  doesn't work unless you explicitly sync with PEEKTO   */                    
  3939. Address "COMMAND" 'GLOBALV SELECT GOPHERD GET HOST PORT PATH MENU'              
  3940. localhost = host                                                                
  3941. localport = port                                                                
  3942. localpath = path                                                                
  3943. Say "Global PATH =" path                                                        
  3944.                                                                                 
  3945. Do Forever                                                                      
  3946.                                                                                 
  3947.     'PEEKTO RECORD'                                                             
  3948.     If rc ^= 0 Then Leave                                                       
  3949.                                                                                 
  3950.     key = Left(record,1)                                                        
  3951.     Select  /*  key  */                                                         
  3952.         When key = "*" Then nop                                                 
  3953.         When Strip(record) = "" Then nop                                        
  3954.         When key = " " Then Call FILELIST                                       
  3955.         Otherwise           Call PREFAB                                         
  3956.         End  /*  Select  key  */                                                
  3957.     If rc ^= 0 Then Leave                                                       
  3958.                                                                                 
  3959.     'READTO'                                                                    
  3960.     If rc ^= 0 Then Leave                                                       
  3961.                                                                                 
  3962.     End  /*  Do  For  */                                                        
  3963.                                                                                 
  3964. Exit rc * (rc ^= 12)                                                            
  3965.                                                                                 
  3966.                                                                                 
  3967.                                                                                 
  3968. /* ------------------------------------------------------------ FILELIST        
  3969.  *  We're apparently reading a plain FILELIST or LISTFILE output.               
  3970.  */                                                                             
  3971. FILELIST:                                                                       
  3972.                                                                                 
  3973. q1 = Index(record,"'")                                                          
  3974. q2 = Index(record,'"')                                                          
  3975. Select                                                                          
  3976.     When  q1 = 0  & q2 = 0  Then                                                
  3977.         Parse Var record fn ft fm fp '05'x name '05'x type '05'x .              
  3978.     When  q1 = 0  Then                                                          
  3979.         Parse Var record fn ft fm fp '"'name'"' type .                          
  3980.     When  q2 = 0  Then                                                          
  3981.         Parse Var record fn ft fm fp "'"name"'" type .                          
  3982.     When  q1 > q2 Then                                                          
  3983.         Parse Var record fn ft fm fp '"'name'"' type .                          
  3984.     When  q2 > 0  Then                                                          
  3985.         Parse Var record fn ft fm fp "'"name"'" type .                          
  3986.     End  /*  Select  */                                                         
  3987.                                                                                 
  3988. If ft = "" Then ft = "*"                                                        
  3989. If fm = "" Then fm = "*"                                                        
  3990. If ft = "GOPHER" | ft = "GOPLINK" Then Do                                       
  3991.     /*  read gopher link information  */                                        
  3992.     'CALLPIPE <' fn ft fm '| GOPSRVGL | *:'                                     
  3993.     Return                                                                      
  3994.     End                                                                         
  3995.                                                                                 
  3996. /*  this is for Yossie:  hide filemode zero  */                                 
  3997. If Length(fm) > 1 Then If Substr(fm,2,1) = '0' Then Return                      
  3998.                                                                                 
  3999. fp = Strip(fp)                                                                  
  4000. If fp = "" Then Do                                                              
  4001.     If  Index(fn ft, '*') > 0   | ,                                             
  4002.         ft = "FILELIST"         Then fp = Translate(fn,lc,uc)                   
  4003.     Else  fp = Translate(fn||'.'||ft,lc,uc)                                     
  4004.     End  /*  If  ..  Do  */                                                     
  4005.                                                                                 
  4006. If name = "" Then name = fp     /*  default name is relative path  */           
  4007. fp = Translate(fp,"%","/")        /*  no slashes in partial path!  */           
  4008. If type = "" Then type = gtype(ft)                                              
  4009. host = localhost                                                                
  4010. port = localport                                                                
  4011. path = type || localpath || '/' || fp                                           
  4012.                                                                                 
  4013. /* read overrides from the NAMES file, if any */                                
  4014. If menu ^= "" Then Call GOVER                                                   
  4015.                                                                                 
  4016. 'OUTPUT' type || name || '05'x || ,                                             
  4017.       /* type */ path || '05'x || ,                                             
  4018.                  host || '05'x || port                                          
  4019.                                                                                 
  4020. Return                                                                          
  4021.                                                                                 
  4022.                                                                                 
  4023.                                                                                 
  4024. /* -------------------------------------------------------------- PREFAB        
  4025.  *  Preceeding stage has supplied some of the parameters.  (thank you)          
  4026.  */                                                                             
  4027. PREFAB:                                                                         
  4028.                                                                                 
  4029. Parse Var record name '05'x path '05'x host '05'x port '05'x rest               
  4030. Parse Var path 1 type 2 path                                                    
  4031. path = type || localpath || '/' || path                                         
  4032. If host = "" Then host = localhost                                              
  4033. If port = "" Then port = localport                                              
  4034. 'OUTPUT' name || '05'x || path || '05'x || ,                                    
  4035.          host || '05'x || port || '05'x || rest                                 
  4036. Return                                                                          
  4037.                                                                                 
  4038.                                                                                 
  4039.                                                                                 
  4040. /* --------------------------------------------------------------- GOVER        
  4041.  *  Read the specified NAMES file for menu data overrides, if any.              
  4042.  */                                                                             
  4043. GOVER:                                                                          
  4044.                                                                                 
  4045. Address "COMMAND" 'STATE' menu 'NAMES *'                                        
  4046. If rc ^= 0 Then Return                                                          
  4047.                                                                                 
  4048. 'CALLPIPE COMMAND NAMEFIND :NICK' fp ,                                          
  4049.         ':TYPE :NAME :PATH :HOST :PORT (FILE' menu ,                            
  4050.         '| VAR _TYPE | DROP | VAR _NAME | DROP | VAR _PATH | DROP' ,            
  4051.         '| VAR _HOST | DROP | VAR _PORT'                                        
  4052. If rc ^= 0 Then                                                                 
  4053. 'CALLPIPE COMMAND NAMEFIND :FN' fn ':FT' ft ,                                   
  4054.         ':TYPE :NAME :PATH :HOST :PORT (FILE' menu ,                            
  4055.         '| VAR _TYPE | DROP | VAR _NAME | DROP | VAR _PATH | DROP' ,            
  4056.         '| VAR _HOST | DROP | VAR _PORT'                                        
  4057. If rc ^= 0 Then Return                                                          
  4058.                                                                                 
  4059. /*      defaults for  type, name, path, host, port    *                         
  4060.  *      are supplied by the calling routine           */                        
  4061.                                                                                 
  4062. If _host ^= "" Then host = _host                                                
  4063. If _port ^= "" Then port = _port                                                
  4064. If _path ^= "" Then path = _path                                                
  4065. If _name ^= "" Then name = _name                                                
  4066. If _type ^= "" Then type = _type                                                
  4067.                                                                                 
  4068. Select                                                                          
  4069.     When _host ^= "" & _port = "" Then port = 70                                
  4070.     When _host = "" & _port ^= "" Then host = localhost                         
  4071.     Otherwise nop                                                               
  4072.     End  /*  When  Select  */                                                   
  4073.                                                                                 
  4074. If _host ^= "" | _port ^= "" Then Do                                            
  4075.     path = _path                                                                
  4076.     type = _type                                                                
  4077.     If type = "" Then type = "1"                                                
  4078.     End  /*  If  ..  Do  */                                                     
  4079. Else If _type ^= "" & _path = "" Then                                           
  4080.     path = _type || localpath || '/' || fp                                      
  4081.                                                                                 
  4082. Return                                                                          
  4083.                                                                                 
  4084.                                                                                 
  4085.                                                                                 
  4086. /* --------------------------------------------------------------- GTYPE        
  4087.  * Returns the default Gopher type character for CMS filetype specified.        
  4088.  */                                                                             
  4089. GTYPE:    Procedure                                                             
  4090. Parse Arg ft                                                                    
  4091. Select  /*  ft  */                                                              
  4092.     When ft = "*"        Then Return '1'                                        
  4093.     When ft = "-"        Then Return '1'                                        
  4094.     When ft = ""         Then Return '1'                                        
  4095.     When ft = "FILELIST" Then Return '1'                                        
  4096.     When ft = "GOPHER"   Then Return '1'                                        
  4097. /*  When ft = "CSO"      Then Return '2'  */                                    
  4098. /*  When ft = ?          Then Return '3'  */                                    
  4099. /*  When ft = "MAC"      Then Return '4'  */                                    
  4100. /*  When ft = "DOS"      Then Return '5'  */                                    
  4101.     When ft = "UUE"      Then Return '6'                                        
  4102. /*  When ft = "SEARCH"   Then Return '7'  */                                    
  4103. /*  When ft = "TELNET"   Then Return '8'  */                                    
  4104.     When ft = "TXT"      Then Return '0'    /*  plain text  */                  
  4105.     When ft = "TEXT"     Then Return '9'    /*  deck; not plain text  */        
  4106.     When ft = "TXTLIB"   Then Return '9'                                        
  4107.     When Left(ft,3) = "TXT" Then Return '9'                                     
  4108.     When ft = "CARDDUMP" Then Return '9'                                        
  4109.     When ft = "TAR"      Then Return '9'                                        
  4110.     When ft = "EXE"      Then Return '9'                                        
  4111.     When ft = "DVI"      Then Return '9'                                        
  4112.     When ft = "TFM"      Then Return '9'                                        
  4113.     When ft = "FMT"      Then Return '9'                                        
  4114.     When ft = "ADMGDF"   Then Return '9'                                        
  4115.     When ft = "ADMSYMBL" Then Return '9'                                        
  4116.     When ft = "SASUSER"  Then Return '9'                                        
  4117.     When ft = "SAS6USER" Then Return '9'                                        
  4118.     When ft = "SND"      Then Return 's'                                        
  4119. /*  When ft = "EPS"      Then Return 'p'  */                                    
  4120. /*  When ft = "PS"       Then Return 'p'  */                                    
  4121.     When ft = "MODULE"   Then Return 'v'                                        
  4122.     When ft = "LOADLIB"  Then Return 'v'                                        
  4123.     When ft = "XRX"      Then Return 'v'                                        
  4124.     When ft = "GIF"      Then Return 'I'                                        
  4125.     Otherwise                 Return '0'                                        
  4126.     End  /*  Select  ft  */                                                     
  4127.                                                                                 
  4128. :READ  GOPSRVGL REXX     A1 TMP200 01/25/93 14:03:03                            
  4129. /*                                                                              
  4130.  *        Name: GOPSRVGL REXX                                                   
  4131.  *              read and process a GOPHER (link) file for GOPHERD               
  4132.  *      Author: Rick Troth, Rice University, Information Systems                
  4133.  *        Date: 1993-Jan-15                                                     
  4134.  */                                                                             
  4135.                                                                                 
  4136. /*                                                                              
  4137.  *      Copyright 1993 Richard M. Troth.   This software was developed          
  4138.  *      with resources provided by Rice University and is intended              
  4139.  *      to serve Rice's user community.   Rice has benefitted greatly           
  4140.  *      from the free distribution of software,  therefore distribution         
  4141.  *      of unmodified copies of this material is not restricted.                
  4142.  *      You may change your own copy as needed.   Neither Rice                  
  4143.  *      University nor any of its employees or students shall be held           
  4144.  *      liable for damages resulting from the use of this software.             
  4145.  */                                                                             
  4146.                                                                                 
  4147. Address "COMMAND" 'GLOBALV SELECT GOPHERD GET HOST PORT'                        
  4148. localhost = host;   localport = port                                            
  4149. host = "";  port = "";  path = "";  name = "";  type = ""                       
  4150.                                                                                 
  4151. Do Forever                                                                      
  4152.                                                                                 
  4153.     'PEEKTO RECORD'                                                             
  4154.     If rc ^= 0 Then Leave                                                       
  4155.                                                                                 
  4156.     If Left(record,1) = '*' Then Call WRITELINK                                 
  4157.     If Left(record,1) = '#' Then Call WRITELINK                                 
  4158.     If rc ^= 0 Then Leave                                                       
  4159.                                                                                 
  4160.     Parse Var record var '=' val                                                
  4161.     Upper var; var = Strip(var)                                                 
  4162.     Select  /*  var  */                                                         
  4163.         When var = "TYPE" Then type = Strip(val)                                
  4164.         When var = "NAME" Then name = val                                       
  4165.         When var = "PATH" Then path = val                                       
  4166.         When var = "HOST" Then host = Strip(val)                                
  4167.         When var = "PORT" Then port = Strip(val)                                
  4168.         Otherwise nop   /*  ignore invalid lines  */                            
  4169.         End  /*  Select  var  */                                                
  4170.                                                                                 
  4171.     'READTO'                                                                    
  4172.     If rc ^= 0 Then Leave                                                       
  4173.                                                                                 
  4174.     End  /*  Do  Forever  */                                                    
  4175.                                                                                 
  4176. If rc = 12 Then Call WRITELINK                                                  
  4177.                                                                                 
  4178. Exit rc * (rc ^= 12)                                                            
  4179.                                                                                 
  4180.                                                                                 
  4181.                                                                                 
  4182. /* ----------------------------------------------------------- WRITELINK        
  4183.  *  Looks like a break.  Iff we have everthing,                                 
  4184.  *  then write this link and reset the variables to empty strings.              
  4185.  */                                                                             
  4186. WRITELINK:                                                                      
  4187. If  name = "" | type = "" Then  Return                                          
  4188. If  host = ""   Then host = localhost                                           
  4189. If  host = "+"  Then host = localhost                                           
  4190. If  type = "FILE"       Then type = '0'                                         
  4191. If  type = "DIRECTORY"  Then type = '1'                                         
  4192. If  port = "" Then                                                              
  4193. Select  /*  type  */                                                            
  4194.     When  type = '2'  Then port = '105'                                         
  4195.     When  type = '8'  Then port = '23'                                          
  4196.     When  type = 'T'  Then port = '23'                                          
  4197.     Otherwise port = '70'                                                       
  4198.     End  /*  Select  type  */                                                   
  4199. 'OUTPUT' type || name || '05'x || path || '05'x ,                               
  4200.               || host || '05'x || port                                          
  4201. host = "";  port = "";  path = "";  name = "";  type = ""                       
  4202. Return                                                                          
  4203.                                                                                 
  4204. :READ  GOPSRVAU EXEC     A1 TMP200 01/18/93 15:56:03                            
  4205. /*                                                                              
  4206.  *        Name: GOPSRVAU EXEC, authorization function                           
  4207.  *              returns TRUE (1) if the file/menu may be retrieved              
  4208.  *              returns FALSE (0) otherwise                                     
  4209.  *        Date: 1993-Jan-18                                                     
  4210.  *      Author: Rick Troth, Rice University, Information Systems                
  4211.  *                                                                              
  4212.  *              This file is part of CMS Gopher.                                
  4213.  */                                                                             
  4214.                                                                                 
  4215. /*                                                                              
  4216.  *      Copyright 1993 Richard M. Troth.   This software was developed          
  4217.  *      with resources provided by Rice University and is intended              
  4218.  *      to serve Rice's user community.   Rice has benefitted greatly           
  4219.  *      from the free distribution of software,  therefore distribution         
  4220.  *      of unmodified copies of this material is not restricted.                
  4221.  *      You may change your own copy as needed.   Neither Rice                  
  4222.  *      University nor any of its employees or students shall be held           
  4223.  *      liable for damages resulting from the use of this software.             
  4224.  */                                                                             
  4225.                                                                                 
  4226. /* ---------------------------------------------------------- AUTHORIZED        
  4227.  * Verify that the client is allowed access, based on IP addr or name.          
  4228.  * (we originally used an internal routine called IPA2C(),  but Arty's          
  4229.  * RXSOCKET provides an Inet_addr() function,  which is now preferred)          
  4230.  */                                                                             
  4231. AUTHORIZED:                                                                     
  4232. Parse Upper Arg Client,AuthList                                                 
  4233. If AuthList = "" Then Return 1                                                  
  4234. ClientAddr = Inet_addr(Client)                                                  
  4235.                                                                                 
  4236. rc = Socket('GetHostByAddr', ClientAddr, 'ClientName')                          
  4237. If rc = "-1" Then ClientName = Client                                           
  4238. Say "Client looks like" ClientName Inet_ntoa(ClientAddr)                        
  4239. Upper ClientName                                                                
  4240.                                                                                 
  4241. allow = 1                                                                       
  4242. Do While AuthList ^= ""                                                         
  4243.                                                                                 
  4244.     Parse Var AuthList Auth AuthList                                            
  4245.     If Auth = "DENY" Then Do                                                    
  4246.         allow = 0; Parse Var AuthList Auth AuthList                             
  4247.         End  /*  If  ..  Do  */                                                 
  4248.     If Auth = "ALLOW" Then Do                                                   
  4249.         allow = 1; Parse Var AuthList Auth AuthList                             
  4250.         End  /*  If  ..  Do  */                                                 
  4251.     Say "Auth" Auth                                                             
  4252.     If Auth = '*' Then Return allow                                             
  4253.                                                                                 
  4254.     Parse Var Auth Auth "," AuthMask "," .                                      
  4255.     AuthAddr = Inet_addr(Auth)                                                  
  4256.     If AuthAddr = "-1" Then Do              /* process as a name spec */        
  4257.         If Left(Auth,1) = '.' Then Do                                           
  4258.             TruncName = Right(ClientName,Length(Auth))                          
  4259.             Say "Truncated ClientName" TruncName                                
  4260.             If TruncName = Auth Then Return allow                               
  4261.             End  /*  If  ..  Do  */                                             
  4262.         Else If ClientName = Auth Then Return allow                             
  4263.         End  /*  If  ..  Do  */                                                 
  4264.                                                                                 
  4265.     Else Do                                 /* must be a numeric spec */        
  4266.         AuthMask = Inet_addr(AuthMask)                                          
  4267.         If AuthMask = "-1" Then Do                                              
  4268.             AuthMask = bitand(AuthAddr,'C0000000'x)                             
  4269.             Select  /*  AuthMask  */                                            
  4270.                 When AuthMask = '00000000'x Then AuthMask = 'FF000000'x         
  4271.                 When AuthMask = '80000000'x Then AuthMask = 'FFFF0000'x         
  4272.                 When AuthMask = 'C0000000'x Then AuthMask = 'FFFFFF00'x         
  4273.                 End  /*  Select  AuthMask  */                                   
  4274.             End  /*  If  ..  Do  */                                             
  4275.         Say "ADDR" c2x(AuthAddr) "MASK" c2x(AuthMask)                           
  4276.         AuthAddr = bitxor(AuthAddr,ClientAddr)                                  
  4277.         AuthAddr = bitand(AuthAddr,AuthMask)                                    
  4278.         If AuthAddr = '00000000'x Then Return allow                             
  4279.         End  /*  Else  Do  */                                                   
  4280.                                                                                 
  4281.     End  /*  Do  While  */                                                      
  4282.                                                                                 
  4283. Return 0                                                                        
  4284.                                                                                 
  4285. :READ  GOPSRVYS REXX     A1 TMP200 01/22/93 15:41:34                            
  4286. /*                                                                              
  4287.  *        Name: GOPSRVYS REXX                                                   
  4288.  *              Gopher Server Search Engine utilizing WISHLP                    
  4289.  *              Original by Yossie Silverman <YOSSIE@UCSFVM>                    
  4290.  *                                                                              
  4291.  *   To create a search item do the following:                                  
  4292.  *                                                                              
  4293.  *     1) Create a standard gopher FILELIST of all files to be                  
  4294.  *        searched.  (Only ' fn ft fm title' will work, fm can                  
  4295.  *        (and should) be *                                                     
  4296.  *     2) GOPGEN INDEX menu                                                     
  4297.  *     3) Put the name and title of the searched menu                           
  4298.  *        in the menu you want to access it from (parent)                       
  4299.  *     4) Mark the searched menu as Type 7 either                               
  4300.  *        with a NAMES file or in the parent menu.                              
  4301.  */                                                                             
  4302.                                                                                 
  4303. Parse Arg search                            /* retrieve search string */        
  4304.                                                                                 
  4305. 'PEEKTO'            /*  sync with input  */                                     
  4306.                                                                                 
  4307. Address "COMMAND" 'GLOBALV SELECT GOPHERD GET MENU FM'                          
  4308. 'CALLPIPE COMMAND LISTFILE' menu 'GOPINDEX * (NOHEADER' ,                       
  4309.         '| VAR FILESPEC'                                                        
  4310. If rc ^= 0 Then Exit rc                                                         
  4311. Parse Var filespec . . fm .                                                     
  4312. Say "GOPSRVYS: MENU =" menu '-' fm                                              
  4313. 'CALLPIPE COMMAND WISHLP' menu 'GOPINDEX' fm search ,                           
  4314.         '| SPEC /      / 1 1-* NEXT | *:'                                       
  4315.                                                                                 
  4316. Exit rc                                                                         
  4317.                                                                                 
  4318. :READ  GOPHERD  DIRECT   A1 TMP200 01/20/93 18:23:09                            
  4319. USER     GOPHERD  pppppppp 12M  12M  G                                  GOP00010
  4320.  INCLUDE  CMS                                                           GOP00020
  4321. *:name.GopherD service virtual machine :list.TCPMAINT                   GOP00030
  4322.  ACCOUNT  aaaaaaaa dddd                                                 GOP00040
  4323.  ACIGROUP gggggggg                                                      GOP00050
  4324.  LINK     TCPMAINT  591      191     RR                                 GOP00060
  4325.  LINK     TCPMAINT  592      192     RR                                 GOP00070
  4326. * at Rice, GOPHERD owns the product disk:                               GOP00080
  4327.  MDISK     240 3380 ssss    2 vvvvvv   RR   ALL                         GOP00090
  4328. *                                                                       GOP00100
  4329. * YES, you can have multiple GopherD service virtual machines.          GOP00110
  4330. * See page 127 of the VM TCP/IP v2r2 Planning and Customization guide   GOP00120
  4331. * for an example,  "Configuring the FTP Server / Multiple FTP Servers". GOP00130
  4332. *                                                                       GOP00140
  4333. :READ  EXPAND   REXX     A1 TMP200 12/07/92 12:11:36                            
  4334. /*                                                                              
  4335.  *        Name: EXPAND REXX                                                     
  4336.  *              Expand Tab Characters function as a pipeline filter             
  4337.  *              This gem can be replaced with  UNTAB 8,  if available.          
  4338.  *      Author: Rick Troth, Rice University, Information Systems                
  4339.  *        Date: 1992-Apr-17, Dec-06                                             
  4340.  */                                                                             
  4341.                                                                                 
  4342. /*  'CALLPIPE *: | UNTAB 8 | *:'  */                                            
  4343.                                                                                 
  4344. Do Forever                                                                      
  4345.                                                                                 
  4346.     'PEEKTO LINE'                                                               
  4347.     If rc ^= 0 Then Leave                                                       
  4348.                                                                                 
  4349.     tabpos = Pos('05'x,line)                                                    
  4350.     Do While tabpos > 0                                                         
  4351.         line = Substr(line,1,tabpos-1) || ,                                     
  4352.                Copies('40'x,((tabpos+7)%8)*8-tabpos+1) || ,                     
  4353.                Substr(line,tabpos+1)                                            
  4354.         tabpos = Pos('05'x,line)                                                
  4355.         End  /*  Do  While  */                                                  
  4356.                                                                                 
  4357.     'OUTPUT' line                                                               
  4358.     If rc ^= 0 Then Leave                                                       
  4359.                                                                                 
  4360.     'READTO'                                                                    
  4361.                                                                                 
  4362.     End  /*  Do  While  */                                                      
  4363.                                                                                 
  4364. Exit rc * (rc ^= 12)                                                            
  4365.                                                                                 
  4366. :READ  PRINT    REXX     A1 TMP200 01/13/93 12:44:38                            
  4367. /*                                                                              
  4368.  *        Name: PRINT REXX                                                      
  4369.  *              a disposable filter for printing from                           
  4370.  *              Pipelines-based applications such as CMS Gopher.                
  4371.  *              (disposable in that you can replace it with your own)           
  4372.  *      Author: Rick Troth, Rice University, Information Systems                
  4373.  *              Thanks to Jim Colten for two better versions of                 
  4374.  *              "STANDARD".                                                     
  4375.  *        Date: Spring 1992, 1993-Jan-07                                        
  4376.  *                                                                              
  4377.  *        Note: Address() returns garbage in a pipelines stage                  
  4378.  */                                                                             
  4379.                                                                                 
  4380. dev = "00E"                                                                     
  4381. linecount = 55                                                                  
  4382. upcase = 0                                                                      
  4383.                                                                                 
  4384. Parse       Arg name '(' opts ')' .                                             
  4385. Parse Upper Var name fn ft fm .                                                 
  4386. fn = Left(fn,8); ft = Left(ft,8)                                                
  4387.                                                                                 
  4388. fml = Length(fm)                                                                
  4389. Select  /*  fml  */                                                             
  4390.     When fml = 1 Then If Datatype(Left(fm1,1),'N') Then fm = ""                 
  4391.     When fml = 2 Then Do                                                        
  4392.         If Datatype(Left(fm,1),'N') Then fm = ""                                
  4393.         If ^Datatype(Right(fm,1),'N') Then fm = ""                              
  4394.         End  /*  When  ..  Do  */                                               
  4395.     Otherwise fm = ""                                                           
  4396.     End  /*  Select  fm  */                                                     
  4397.                                                                                 
  4398. If Words(name) = 2 | Words(name) = 3 Then                                       
  4399.     name = Left(fn,8) Left(ft,8) Left(fm,2)                                     
  4400.                                                                                 
  4401. 'CALLPIPE COMMAND QUERY CMSLEVEL | CHOP , | VAR CMSLEVEL'                       
  4402. 'CALLPIPE CP      QUERY CPLEVEL  | CHOP , | VAR CPLEVEL'                        
  4403. title = "File:" Left(fn,8) Left(ft,8) Left(fm,2) cmslevel '/' cplevel           
  4404.                                                                                 
  4405. cc = (ft = "LISTING"  | ft = "LIST3800" | ,                                     
  4406.       ft = "LISTCPDS" | ft = "LIST3820" | ft = "LIST38PP")                      
  4407.                                                                                 
  4408. Do While opts ^= ""                                                             
  4409.     Parse Var opts op opts; Upper op                                            
  4410.     Select  /*  op  */                                                          
  4411.         When Abbrev("LINECOUNT",op,2) Then Do                                   
  4412.             Parse Var opts linecount opts                                       
  4413.             If linecount = "" Then linecount = 55                               
  4414.             End  /*  When  ..  Do  */                                           
  4415.         When Abbrev("UPCASE",op,2)  Then upcase = 1                             
  4416.         When Abbrev("CC",op,2)      Then cc = 1                                 
  4417.         When Abbrev("NOCC",op,4)    Then cc = 0                                 
  4418.         When Abbrev("TITLE",op,1)   Then Do                                     
  4419.             title = opts                                                        
  4420.             opts = ""                                                           
  4421.             End  /*  When  ..  Do  */                                           
  4422.         Otherwise Say "Unrecognized option" op                                  
  4423.         End  /*  Select  op  */                                                 
  4424.     End  /*  Do  While  */                                                      
  4425.                                                                                 
  4426. If cc Then 'CALLPIPE *: | ASATOMC | URO' dev                                    
  4427. /*    Else Call STANDARD      */                                                
  4428. Else Do Forever                                                                 
  4429.     'PEEKTO'                                                                    
  4430.     If rc ^= 0 Then Leave                                                       
  4431.     'CALLPIPE *: | TAKE' linecount ,                                            
  4432.         '| SPEC .09. X2C 1  1-* NEXT' ,                                         
  4433.         '| PREFACE LITERAL' '19'x || title ,                                    
  4434.         '| PREFACE LITERAL' '89'x ,                                             
  4435.         '| URO' dev                                                             
  4436.     If rc ^= 0 Then Leave                                                       
  4437.     End  /*  Else  ..  Do  Forever  */                                          
  4438. prc = rc * (rc ^= 12)                                                           
  4439.                                                                                 
  4440. /*  use  CP CLOSE,  so the user can  SPOOL dev CONT  if he wants to  */         
  4441. If fn = "" Then Parse Value Diag(08,'CLOSE' dev) With rs                        
  4442.            Else Parse Value Diag(08,'CLOSE' dev 'NAME' fn ft) With rs           
  4443.                                                                                 
  4444. If rs ^= "" Then                                                                
  4445.     'CALLPIPE VAR RS | SPLIT AT STRING "' || '15'x || '" | *:'                  
  4446.                                                                                 
  4447. Return prc                                                                      
  4448.                                                                                 
  4449.                                                                                 
  4450.                                                                                 
  4451. /* ------------------------------------------------------------ STANDARD        
  4452.  *  Here is a version of STANDARD that loops once per page rather than          
  4453.  *  once per record.  It should work with most versions of Pipelines.           
  4454.  */                                                                             
  4455. STANDARD:                                                                       
  4456. header = '19'x || title                                                         
  4457. 'PEEKTO'                                                                        
  4458. Do While rc = 0                                                                 
  4459.     'CALLPIPE *: | TAKE' linecount ,                                            
  4460.         '| SPEC .09. X2C 1  1-* NEXT' ,                                         
  4461.         '| PREFACE VAR HEADER' ,                                                
  4462.         '| PREFACE LITERAL' '89'x ,                                             
  4463.         '| URO' dev                                                             
  4464.     'PEEKTO'                                                                    
  4465.     End  /*  Do  Forever*/                                                      
  4466. Return                                                                          
  4467.                                                                                 
  4468.                                                                                 
  4469.                                                                                 
  4470. /* ------------------------------------------------------------ PRINTASA        
  4471.  */                                                                             
  4472. PRINTASA:                                                                       
  4473.                                                                                 
  4474. 'ADDPIPE *.OUTPUT: | URO' dev                                                   
  4475.                                                                                 
  4476. 'PEEKTO LINE'                                                                   
  4477. Do While rc = 0                                                                 
  4478.     Parse Var line 1 byte 2 line                                                
  4479.     line = byte || line                                                         
  4480.     'OUTPUT' line                                                               
  4481.     'READTO'                                                                    
  4482.     'PEEKTO LINE'                                                               
  4483.     End  /*  Do  While  */                                                      
  4484.                                                                                 
  4485. Return                                                                          
  4486.                                                                                 
  4487.                                                                                 
  4488.                                                                                 
  4489. /*                                                                              
  4490.                                                                                 
  4491. OVersize                                                                        
  4492.     allows you to print:                                                        
  4493.                                                                                 
  4494.     *  files that have records larger than the carriage size of the             
  4495.        virtual printer, and                                                     
  4496.                                                                                 
  4497.     *  files that have a SPECIAL status of YES.                                 
  4498.                                                                                 
  4499.     When the OVERSIZE option is used, the CC option will be set as              
  4500.     a default.  This default setting of CC can be overridden by                 
  4501.     specifying either the NOCC or the HEX option with the OVersize              
  4502.     option.                                                                     
  4503.                                                                                 
  4504.      If the file has a SPECIAL status of YES (and NOCC is not specified),       
  4505.      any records with a carriage control character of x'5A' will be             
  4506.      printed if all of the following conditions are true:                       
  4507.         - the record length is not greater than 32767 bytes.                    
  4508.         - a printer subsystem that handles the x'5A' carriage controller        
  4509.           (such as the 3820 or 3800-3/8) is utilized.                           
  4510.         - a software package that handles such characters (such as PSF)         
  4511.           is utilized.                                                          
  4512.      Otherwise, these records will not be printed.                              
  4513.                                                                                 
  4514.      Other records that are larger than the virtual printer's carriage          
  4515.      size are printed, but are truncated to the carriage size (or               
  4516.      carriage size + 1 if CC is specified).                                     
  4517.                                                                                 
  4518.      (The SPECIAL status indicates whether or not the file contains records     
  4519.      with X'5A' carriage control characters.  See the CP QUERY command to       
  4520.      determine SPECIAL status of a file.)                                       
  4521.                                                                                 
  4522.     The OVERSIZE (and CC) option is assumed if the filetype is                  
  4523.     LISTCPDS, LIST3820, or LIST38PP.  If OVERSIZE is not specified and          
  4524.     the file you want to print is larger than the virtual printer's             
  4525.     carriage size, the message "Records exceeds allowable maximum"              
  4526.     is displayed.                                                               
  4527.                                                                                 
  4528. CC (HEADer)                                                                     
  4529.     interprets the first character of each record as a carriage                 
  4530.     control character.  If the filetype is LISTING, LIST3800, or                
  4531.     LISTCPDS, the CC option is assumed.  If CC is in effect, the PRINT          
  4532.     command neither performs page ejects nor counts the number of               
  4533.     lines per page; these functions are controlled by the carriage              
  4534.     control characters in the file.  The LINECOUN option has no effect          
  4535.     if CC is in effect.                                                         
  4536.                                                                                 
  4537.     HEADER creates a shortened header page with only the filename,              
  4538.     filetype, and filemode at the top of the page that follows the              
  4539.     standard header page.  The records in the file being printed begin          
  4540.     on a new page following both header pages.  The HEADER option can           
  4541.     only be used in conjunction with the CC option.  If the CC option           
  4542.     is not specified HEADER has no effect.                                      
  4543.                                                                                 
  4544. TRC                                                                             
  4545.     interprets the first data byte in each record as a TRC (Table Ref-          
  4546.     erence Character) byte.  The value of the TRC byte determines               
  4547.     which translate table the 3800 printer selects to print a record.           
  4548.     The value of the TRC byte corresponds to the order in which you             
  4549.     have loaded WCGMs (via the CHARS keyword of the SETPRT command).            
  4550.     Valid values for TRC are 0, 1, 2, and 3.  If an invalid value is            
  4551.     found, a TRC byte of 0 is assumed.  If the filetype is LIST3800,            
  4552.     TRC is assumed.                                                             
  4553.                                                                                 
  4554. NOTRC                                                                           
  4555.     does not interpret the first data byte in each record as a TRC              
  4556.     byte.  NOTRC is the default.                                                
  4557.                                                                                 
  4558. MEMber    <*         >                                                          
  4559.           <membername>                                                          
  4560.     prints the members of macro or text libraries. This option may be           
  4561.     specified if the file is a simulated partitioned data set                   
  4562.     (filetype MACLIB, TXTLIB, or LOADLIB).  If an asterisk (*) is               
  4563.     entered, all individual members of that library are printed. If a           
  4564.     membername is specified, only that member is printed.                       
  4565.                                                                                 
  4566. HEX                                                                             
  4567.     prints the file in graphic hexadecimal format.  If HEX is speci-            
  4568.     fied, the options CC and UPCASE are ignored, even if specified,             
  4569.     and even if the filetype is LISTING, LIST3800, LISTCPDS, LIST3820,          
  4570.     or LIST38PP.  If both the OVersize and HEX options are specified,           
  4571.     the NOCC option will be in effect.                                          
  4572.                                                                                 
  4573.  */                                                                             
  4574.                                                                                 
  4575.                                                                                 
  4576.                                                                                 
  4577. /* -- Here is a version of STANDARD that does not loop, requires                
  4578.       pipes mod level 6 (for sync) */                                           
  4579. STANDARD2:                                                                      
  4580. header = '19'x || title                                                         
  4581.                                                                                 
  4582.   'CALLPIPE (end \)',                                                           
  4583.     '| literal' '89'x,                /* page eject record?          */         
  4584.     '| append var header',            /* page header record          */         
  4585.     '| spec 1-* 1',                   /* simulate BLOCK LINEND by    */         
  4586.     '       .15. x2c next',           /*   adding linend chars & join*/         
  4587.     '| join *',                       /*     both recs into 1 rec    */         
  4588.     '| dup *',                        /* make an endless supply      */         
  4589.     ,                                                                           
  4590.     '| a: sync',                      /* 2 streams marching together */         
  4591.     '| b: faninany',                  /* combine the streams         */         
  4592.     ,                                                                           
  4593.     '| deblock linend',               /* deblock into separate recs  */         
  4594.     '| uro' dev,                      /* print it                    */         
  4595.     ,                                                                           
  4596.     '\ *:',                           /* incoming records            */         
  4597.     '| spec .09. x2c 1',              /* add charriage control and   */         
  4598.     '       1-* next',                /*  simulate BLOCK LINEND by   */         
  4599.     '       .15. x2c next',           /*    adding linend chars &    */         
  4600.     '| join' linecount-1,     /* join all recs for a page into 1 rec */         
  4601.     '| a:',                           /* send through sync           */         
  4602.     '| b:'        /* sync sends them back, now send them to faninany */         
  4603.                                                                                 
  4604. Return                                                                          
  4605.                                                                                 
  4606. :READ  A2E      REXX     A1 TMP200 09/24/92 08:16:13                            
  4607. /* ----------------------------------------------------------------- â•žCS        
  4608.  * ASCII to EBCDIC and vice-versa code conversion tables.                       
  4609.  * Tables included here are based on ASCII conforming to the ISO8859-1          
  4610.  * Latin 1 character set and EBCDIC conforming to the IBM Code Page 37          
  4611.  * Latin 1 character set (except for three pairs of characters in 037).         
  4612.  *                                                                              
  4613.  *        Name: A2E REXX                                                        
  4614.  *              CMS Pipelines filter to translate ASCII to EBCDIC               
  4615.  *      Author: Rick Troth, Rice University, I/S VM Systems Support             
  4616.  *        Date: 1992-Feb-27 for the filter, earlier for the table               
  4617.  *                                                                              
  4618.  *        Note:                                                                 
  4619.  *              These tables are provided in source form so that you            
  4620.  *              may modify them locally.  I recommend that you not              
  4621.  *              modify them just to make things look right on your              
  4622.  *              screen.  If you have an older terminal and there are            
  4623.  *              not more than a dozen code-points that are wrong,               
  4624.  *              then you're better off using CODEPAGE EXEC to set the           
  4625.  *              CMS INPUT/OUTPUT translate tables.   GOPHER EXEC                
  4626.  *              *does respect*  CMS' translate tables.                          
  4627.  */                                                                             
  4628.                                                                                 
  4629.     i =      '000102030405060708090A0B0C0D0E0F'x                                
  4630.     i = i || '101112131415161718191A1B1C1D1E1F'x                                
  4631.     i = i || '202122232425262728292A2B2C2D2E2F'x                                
  4632.     i = i || '303132333435363738393A3B3C3D3E3F'x                                
  4633.     i = i || '404142434445464748494A4B4C4D4E4F'x                                
  4634.     i = i || '505152535455565758595A5B5C5D5E5F'x                                
  4635.     i = i || '606162636465666768696A6B6C6D6E6F'x                                
  4636.     i = i || '707172737475767778797A7B7C7D7E7F'x                                
  4637.     i = i || '808182838485868788898A8B8C8D8E8F'x                                
  4638.     i = i || '909192939495969798999A9B9C9D9E9F'x                                
  4639.     i = i || 'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'x                                
  4640.     i = i || 'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'x                                
  4641.     i = i || 'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'x                                
  4642.     i = i || 'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'x                                
  4643.     i = i || 'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'x                                
  4644.     i = i || 'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'x                                
  4645.                                                                                 
  4646.     e =      '00010203372D2E2F1605250B0C0D0E0F'x                                
  4647.     e = e || '101112133C3D322618193F271C1D1E1F'x                                
  4648.     e = e || '405A7F7B5B6C507D4D5D5C4E6B604B61'x                                
  4649.     e = e || 'F0F1F2F3F4F5F6F7F8F97A5E4C7E6E6F'x                                
  4650.     e = e || '7CC1C2C3C4C5C6C7C8C9D1D2D3D4D5D6'x                                
  4651.     e = e || 'D7D8D9E2E3E4E5E6E7E8E9ADE0BD5F6D'x                                
  4652.     e = e || '79818283848586878889919293949596'x                                
  4653.     e = e || '979899A2A3A4A5A6A7A8A9C04FD0A107'x                                
  4654.     e = e || '202122232415061728292A2B2C090A1B'x                                
  4655.     e = e || '30311A333435360838393A3B04143EFF'x                                
  4656.     e = e || '41AA4AB19FB26AB5BBB49A8AB0CAAFBC'x                                
  4657.     e = e || '908FEAFABEA0B6B39DDA9B8BB7B8B9AB'x                                
  4658.     e = e || '6465626663679E687471727378757677'x                                
  4659.     e = e || 'AC69EDEEEBEFECBF80FDFEFBFCBAAE59'x                                
  4660.     e = e || '4445424643479C485451525358555657'x                                
  4661.     e = e || '8C49CDCECBCFCCE170DDDEDBDC8D8EDF'x                                
  4662.                                                                                 
  4663. /* ----------------------------------------------------------------- A2E        
  4664.  * Translate ASCII to EBCDIC.                                                   
  4665.  */                                                                             
  4666. 'READTO LINE'                                                                   
  4667. Do While rc = 0                                                                 
  4668.     'OUTPUT' Translate(line,e,i)                                                
  4669.     'READTO LINE'                                                               
  4670.     End  /*  Do  While  */                                                      
  4671.                                                                                 
  4672. Exit                                                                            
  4673.                                                                                 
  4674. :READ  E2A      REXX     A1 TMP200 09/24/92 08:33:08                            
  4675. /* ----------------------------------------------------------------- â•žCS        
  4676.  * ASCII to EBCDIC and vice-versa code conversion tables.                       
  4677.  * Tables included here are based on ASCII conforming to the ISO8859-1          
  4678.  * Latin 1 character set and EBCDIC conforming to the IBM Code Page 37          
  4679.  * Latin 1 character set (except for three pairs of characters in 037).         
  4680.  *                                                                              
  4681.  *        Name: E2A REXX                                                        
  4682.  *              CMS Pipelines filter to translate EBCDIC to ASCII               
  4683.  *      Author: Rick Troth, Rice University, I/S VM Systems Support             
  4684.  *        Date: 1992-Feb-27 for the filter, earlier for the table               
  4685.  *                                                                              
  4686.  *        Note:                                                                 
  4687.  *              These tables are provided in source form so that you            
  4688.  *              may modify them locally.  I recommend that you not              
  4689.  *              modify them just to make things look right on your              
  4690.  *              screen.  If you have an older terminal and there are            
  4691.  *              not more than a dozen code-points that are wrong,               
  4692.  *              then you're better off using CODEPAGE EXEC to set the           
  4693.  *              CMS INPUT/OUTPUT translate tables.   GOPHER EXEC                
  4694.  *              *does respect*  CMS' translate tables.                          
  4695.  */                                                                             
  4696.                                                                                 
  4697.     i =      '000102030405060708090A0B0C0D0E0F'x                                
  4698.     i = i || '101112131415161718191A1B1C1D1E1F'x                                
  4699.     i = i || '202122232425262728292A2B2C2D2E2F'x                                
  4700.     i = i || '303132333435363738393A3B3C3D3E3F'x                                
  4701.     i = i || '404142434445464748494A4B4C4D4E4F'x                                
  4702.     i = i || '505152535455565758595A5B5C5D5E5F'x                                
  4703.     i = i || '606162636465666768696A6B6C6D6E6F'x                                
  4704.     i = i || '707172737475767778797A7B7C7D7E7F'x                                
  4705.     i = i || '808182838485868788898A8B8C8D8E8F'x                                
  4706.     i = i || '909192939495969798999A9B9C9D9E9F'x                                
  4707.     i = i || 'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'x                                
  4708.     i = i || 'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'x                                
  4709.     i = i || 'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'x                                
  4710.     i = i || 'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'x                                
  4711.     i = i || 'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'x                                
  4712.     i = i || 'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'x                                
  4713.                                                                                 
  4714.     a =      '000102039C09867F978D8E0B0C0D0E0F'x                                
  4715.     a = a || '101112139D8508871819928F1C1D1E1F'x                                
  4716.     a = a || '80818283840A171B88898A8B8C050607'x                                
  4717.     a = a || '909116939495960498999A9B14159E1A'x                                
  4718.     a = a || '20A0E2E4E0E1E3E5E7F1A22E3C282B7C'x                                
  4719.     a = a || '26E9EAEBE8EDEEEFECDF21242A293B5E'x                                
  4720.     a = a || '2D2FC2C4C0C1C3C5C7D1A62C255F3E3F'x                                
  4721.     a = a || 'F8C9CACBC8CDCECFCC603A2340273D22'x                                
  4722.     a = a || 'D8616263646566676869ABBBF0FDFEB1'x                                
  4723.     a = a || 'B06A6B6C6D6E6F707172AABAE6B8C6A4'x                                
  4724.     a = a || 'B57E737475767778797AA1BFD05BDEAE'x                                
  4725.     a = a || 'ACA3A5B7A9A7B6BCBDBEDDA8AF5DB4D7'x                                
  4726.     a = a || '7B414243444546474849ADF4F6F2F3F5'x                                
  4727.     a = a || '7D4A4B4C4D4E4F505152B9FBFCF9FAFF'x                                
  4728.     a = a || '5CF7535455565758595AB2D4D6D2D3D5'x                                
  4729.     a = a || '30313233343536373839B3DBDCD9DA9F'x                                
  4730.                                                                                 
  4731. /* ----------------------------------------------------------------- E2A        
  4732.  * Translate EBCDIC to ASCII.                                                   
  4733.  */                                                                             
  4734. 'READTO LINE'                                                                   
  4735. Do While rc = 0                                                                 
  4736.     'OUTPUT' Translate(line,a,i)                                                
  4737.     'READTO LINE'                                                               
  4738.     End  /*  Do  While  */                                                      
  4739.                                                                                 
  4740. Exit                                                                            
  4741.                                                                                 
  4742. :READ  TCPA2E   REXX     A1 TMP200 01/05/93 17:34:55                            
  4743. /*                                                                              
  4744.  *        Name: TCPA2E REXX                                                     
  4745.  *              CMS Pipelines filter to translate ASCII to EBCDIC               
  4746.  *              basing translation on VM TCP/IP supplied tables                 
  4747.  *      Author: Rick Troth, Rice University, Information Systems                
  4748.  *        Date: 1992-Apr-27, 1993-Jan-05                                        
  4749.  */                                                                             
  4750.                                                                                 
  4751. Parse Upper Arg table . '(' .                                                   
  4752.                                                                                 
  4753. If table = "" Then table = "STANDARD"                                           
  4754. 'CALLPIPE DISK' table 'TCPXLBIN | STEM XLT.'                                    
  4755.                                                                                 
  4756. /*  if specified table is unavailable,  fall back to default  */                
  4757. If xlt.0 < 3 Then Do                                                            
  4758.     'CALLPIPE *: | A2E | *:'                                                    
  4759.     Exit rc                                                                     
  4760.     End  /*  If  ..  Do  */                                                     
  4761.                                                                                 
  4762. /*                                                                              
  4763.  * variables:                                                                   
  4764.  *              xlt.0   should be "3",  meaning three records read              
  4765.  *              xlt.1   should be a comment                                     
  4766.  *              xlt.2   should be our ASCII ---> EBCDIC table                   
  4767.  *              xlt.3   should be our EBCDIC ---> ASCII table                   
  4768.  *              i       is set to the dummy input table                         
  4769.  */                                                                             
  4770.                                                                                 
  4771.     i =      '000102030405060708090A0B0C0D0E0F'x                                
  4772.     i = i || '101112131415161718191A1B1C1D1E1F'x                                
  4773.     i = i || '202122232425262728292A2B2C2D2E2F'x                                
  4774.     i = i || '303132333435363738393A3B3C3D3E3F'x                                
  4775.     i = i || '404142434445464748494A4B4C4D4E4F'x                                
  4776.     i = i || '505152535455565758595A5B5C5D5E5F'x                                
  4777.     i = i || '606162636465666768696A6B6C6D6E6F'x                                
  4778.     i = i || '707172737475767778797A7B7C7D7E7F'x                                
  4779.     i = i || '808182838485868788898A8B8C8D8E8F'x                                
  4780.     i = i || '909192939495969798999A9B9C9D9E9F'x                                
  4781.     i = i || 'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'x                                
  4782.     i = i || 'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'x                                
  4783.     i = i || 'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'x                                
  4784.     i = i || 'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'x                                
  4785.     i = i || 'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'x                                
  4786.     i = i || 'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'x                                
  4787.                                                                                 
  4788. /* ----------------------------------------------------------------- A2E        
  4789.  * Translate ASCII to EBCDIC.                                                   
  4790.  */                                                                             
  4791. 'READTO LINE'                                                                   
  4792. Do While rc = 0                                                                 
  4793.     'OUTPUT' Translate(line,xlt.2,i)                                            
  4794.     'READTO LINE'                                                               
  4795.     End  /*  Do  While  */                                                      
  4796.                                                                                 
  4797. Exit                                                                            
  4798.                                                                                 
  4799. :READ  TCPE2A   REXX     A1 TMP200 01/05/93 17:34:56                            
  4800. /*                                                                              
  4801.  *        Name: TCPE2A REXX                                                     
  4802.  *              CMS Pipelines filter to translate EBCDIC to ASCII               
  4803.  *              basing translation on VM TCP/IP supplied tables                 
  4804.  *      Author: Rick Troth, Rice University, Information Systems                
  4805.  *        Date: 1992-Apr-27, 1993-Jan-05                                        
  4806.  */                                                                             
  4807.                                                                                 
  4808. Parse Upper Arg table . '(' .                                                   
  4809.                                                                                 
  4810. If table = "" Then table = "STANDARD"                                           
  4811. 'CALLPIPE DISK' table 'TCPXLBIN | STEM XLT.'                                    
  4812.                                                                                 
  4813. /*  if specified table is unavailable,  fall back to default  */                
  4814. If xlt.0 < 3 Then Do                                                            
  4815.     'CALLPIPE *: | E2A | *:'                                                    
  4816.     Exit rc                                                                     
  4817.     End  /*  If  ..  Do  */                                                     
  4818.                                                                                 
  4819. /*                                                                              
  4820.  * variables:                                                                   
  4821.  *              xlt.0   should be "3",  meaning three records read              
  4822.  *              xlt.1   should be a comment                                     
  4823.  *              xlt.2   should be our ASCII ---> EBCDIC table                   
  4824.  *              xlt.3   should be our EBCDIC ---> ASCII table                   
  4825.  *              i       is set to the dummy input table                         
  4826.  */                                                                             
  4827.                                                                                 
  4828.     i =      '000102030405060708090A0B0C0D0E0F'x                                
  4829.     i = i || '101112131415161718191A1B1C1D1E1F'x                                
  4830.     i = i || '202122232425262728292A2B2C2D2E2F'x                                
  4831.     i = i || '303132333435363738393A3B3C3D3E3F'x                                
  4832.     i = i || '404142434445464748494A4B4C4D4E4F'x                                
  4833.     i = i || '505152535455565758595A5B5C5D5E5F'x                                
  4834.     i = i || '606162636465666768696A6B6C6D6E6F'x                                
  4835.     i = i || '707172737475767778797A7B7C7D7E7F'x                                
  4836.     i = i || '808182838485868788898A8B8C8D8E8F'x                                
  4837.     i = i || '909192939495969798999A9B9C9D9E9F'x                                
  4838.     i = i || 'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'x                                
  4839.     i = i || 'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'x                                
  4840.     i = i || 'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'x                                
  4841.     i = i || 'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'x                                
  4842.     i = i || 'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'x                                
  4843.     i = i || 'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'x                                
  4844.                                                                                 
  4845. /* ----------------------------------------------------------------- E2A        
  4846.  * Translate EBCDIC to ASCII.                                                   
  4847.  */                                                                             
  4848. 'READTO LINE'                                                                   
  4849. Do While rc = 0                                                                 
  4850.     'OUTPUT' Translate(line,xlt.3,i)                                            
  4851.     'READTO LINE'                                                               
  4852.     End  /*  Do  While  */                                                      
  4853.                                                                                 
  4854. Exit                                                                            
  4855.                                                                                 
  4856. :READ  STANDARD TCPXLATE A1 TMP200 04/27/92 14:45:29                            
  4857. ;  ----------------------------------------------------------------- â•žCS        
  4858. ;  ASCII to EBCDIC and vice-versa code conversion tables for IBM TCP/IP.        
  4859. ;  Tables defined here are based on ASCII conforming to the ISO8859-1           
  4860. ;  Latin 1 character set and EBCDIC conforming to IBM Code Page 1047            
  4861. ;  Latin 1 character set.   See also AECS C  (from Rice University).            
  4862. ;                                                                               
  4863. ;  ASCII ---> EBCDIC                                                            
  4864. ;       00 01 02 03  04 05 06 07  08 09 0A 0B  0C 0D 0E 0F                      
  4865. ;                                                                               
  4866.         00 01 02 03  37 2D 2E 2F  16 05 25 0B  0C 0D 0E 0F  ; 00 ;              
  4867.         10 11 12 13  3C 3D 32 26  18 19 3F 27  1C 1D 1E 1F  ; 10 ;              
  4868.         40 5A 7F 7B  5B 6C 50 7D  4D 5D 5C 4E  6B 60 4B 61  ; 20 ;              
  4869.         F0 F1 F2 F3  F4 F5 F6 F7  F8 F9 7A 5E  4C 7E 6E 6F  ; 30 ;              
  4870.         7C C1 C2 C3  C4 C5 C6 C7  C8 C9 D1 D2  D3 D4 D5 D6  ; 40 ;              
  4871.         D7 D8 D9 E2  E3 E4 E5 E6  E7 E8 E9 AD  E0 BD 5F 6D  ; 50 ;              
  4872.         79 81 82 83  84 85 86 87  88 89 91 92  93 94 95 96  ; 60 ;              
  4873.         97 98 99 A2  A3 A4 A5 A6  A7 A8 A9 C0  4F D0 A1 07  ; 70 ;              
  4874.         20 21 22 23  24 15 06 17  28 29 2A 2B  2C 09 0A 1B  ; 80 ;              
  4875.         30 31 1A 33  34 35 36 08  38 39 3A 3B  04 14 3E FF  ; 90 ;              
  4876.         41 AA 4A B1  9F B2 6A B5  BB B4 9A 8A  B0 CA AF BC  ; A0 ;              
  4877.         90 8F EA FA  BE A0 B6 B3  9D DA 9B 8B  B7 B8 B9 AB  ; B0 ;              
  4878.         64 65 62 66  63 67 9E 68  74 71 72 73  78 75 76 77  ; C0 ;              
  4879.         AC 69 ED EE  EB EF EC BF  80 FD FE FB  FC BA AE 59  ; D0 ;              
  4880.         44 45 42 46  43 47 9C 48  54 51 52 53  58 55 56 57  ; E0 ;              
  4881.         8C 49 CD CE  CB CF CC E1  70 DD DE DB  DC 8D 8E DF  ; F0 ;              
  4882. ;                                                                               
  4883. ;  EBCDIC ---> ASCII                                                            
  4884. ;       00 01 02 03  04 05 06 07  08 09 0A 0B  0C 0D 0E 0F                      
  4885. ;                                                                               
  4886.         00 01 02 03  9C 09 86 7F  97 8D 8E 0B  0C 0D 0E 0F  ; 00 ;              
  4887.         10 11 12 13  9D 85 08 87  18 19 92 8F  1C 1D 1E 1F  ; 10 ;              
  4888.         80 81 82 83  84 0A 17 1B  88 89 8A 8B  8C 05 06 07  ; 20 ;              
  4889.         90 91 16 93  94 95 96 04  98 99 9A 9B  14 15 9E 1A  ; 30 ;              
  4890.         20 A0 E2 E4  E0 E1 E3 E5  E7 F1 A2 2E  3C 28 2B 7C  ; 40 ;              
  4891.         26 E9 EA EB  E8 ED EE EF  EC DF 21 24  2A 29 3B 5E  ; 50 ;              
  4892.         2D 2F C2 C4  C0 C1 C3 C5  C7 D1 A6 2C  25 5F 3E 3F  ; 60 ;              
  4893.         F8 C9 CA CB  C8 CD CE CF  CC 60 3A 23  40 27 3D 22  ; 70 ;              
  4894.         D8 61 62 63  64 65 66 67  68 69 AB BB  F0 FD FE B1  ; 80 ;              
  4895.         B0 6A 6B 6C  6D 6E 6F 70  71 72 AA BA  E6 B8 C6 A4  ; 90 ;              
  4896.         B5 7E 73 74  75 76 77 78  79 7A A1 BF  D0 5B DE AE  ; A0 ;              
  4897.         AC A3 A5 B7  A9 A7 B6 BC  BD BE DD A8  AF 5D B4 D7  ; B0 ;              
  4898.         7B 41 42 43  44 45 46 47  48 49 AD F4  F6 F2 F3 F5  ; C0 ;              
  4899.         7D 4A 4B 4C  4D 4E 4F 50  51 52 B9 FB  FC F9 FA FF  ; D0 ;              
  4900.         5C F7 53 54  55 56 57 58  59 5A B2 D4  D6 D2 D3 D5  ; E0 ;              
  4901.         30 31 32 33  34 35 36 37  38 39 B3 DB  DC D9 DA 9F  ; F0 ;              
  4902. ;                                                                               
  4903. :READ  GOPUME   MESSAGES A1 TMP200 01/21/93 15:30:04                            
  4904. *                                                                               
  4905. *         Name: GOPUME MESSAGES                                                 
  4906. *               CMS Gopher Message Repository source                            
  4907. *               Thanks to Chris Martin for RICUME as an example.                
  4908. *       Author: Rick Troth, Rice University, Information Systems                
  4909. *         Date: 1992-Dec-17                                                     
  4910. *                                                                               
  4911. *         Note:                                                                 
  4912. *               After changing this file,                                       
  4913. *               run the following command:                                      
  4914. *                                                                               
  4915. *                       GENMSG GOPUME MESSAGES A GOP                            
  4916. *                                                                               
  4917. *               This will create a new GOPUME TEXT which must                   
  4918. *               replace the supplied copy on the product disk.                  
  4919. *                                                                               
  4920. *      Changes: -none-                                                          
  4921. *                                                                               
  4922. ************************************************************************        
  4923. *                                                                               
  4924. *       The following line specifies the substitution character                 
  4925. *       and number of digits of message number to be shown.                     
  4926. *       DO NOT CHANGE!                                                          
  4927. *                                                                               
  4928. & 3                                                                             
  4929. *                                                                               
  4930. ************************************************************************        
  4931. *                                                                               
  4932. *xxx    I CMS Gopher 2.4.0 client                                               
  4933. *                                                                               
  4934. 0000    I Rice CMS Gopher 2.4.0                                                 
  4935. 0001    S You must have RXSOCKET to run CMS Gopher.                             
  4936. 0002    S You must have VM TCP/IP V2 to run CMS Gopher.                         
  4937. 0003    S You must have CMS Pipelines to run CMS Gopher.                        
  4938. 0004    I (root menu)                                                           
  4939. 0005    I More                                                                  
  4940. 0006    E No read/write &1 disk/directory accessed.                             
  4941. 0007    I &1                                                                    
  4942. 0008      Gopher                                                                
  4943. 0009      Client                                                                
  4944. 0010      Server                                                                
  4945. *                                                                               
  4946. 0020    I Connecting ...                                                        
  4947. 0021    I Connecting ... press ENTER twice to abort.                            
  4948. 0022    I Connecting to &1 port &2.                                             
  4949. 0023    I Connection to &1 port &2 refused. (no gopher hole there)              
  4950. 0024    I Reading ...                                                           
  4951. 0025    I Reading ... press ENTER twice to abort.                               
  4952. 0026    I Read &1 bytes.                                                        
  4953. 0027    I Request aborted.                                                      
  4954. 0028    I Connection canceled by user request.                                  
  4955. 0029    I Connection canceled by timeout.                                       
  4956. 0030    I CMS Gopher TELNET connecting to &1 &2                                 
  4957. 0031    I CMS Gopher TN3270 connecting to &1 &2                                 
  4958. 0032    I login with: &1                                                        
  4959. 0033    R Press ENTER to continue ...                                           
  4960. 0034    R Press CLEAR to continue ...                                           
  4961. *                                                                               
  4962. 0040    I &1's Bookmarks                                                        
  4963. 0041    I Bookmark &1 saved.                                                    
  4964. 0042    I Bookmark &1 deleted.                                                  
  4965. 0043    E Can't save/delete bookmarks at this terminal.                         
  4966. 0044    I Bookmarks for &1                                                      
  4967. *                                                                               
  4968. 0060    E Empty menu; no items selected or nothing available.                   
  4969. *                                                                               
  4970. 0100    S Error reading from the terminal.                                      
  4971. 0117    S Error writing to display terminal.                                    
  4972. *                                                                               
  4973. 0394    W Invalid option: &1                                                    
  4974. *                                                                               
  4975. 0507    E Can't PRINT from this terminal.                                       
  4976. 0508    E Can't SAVE/GET files via this terminal.                               
  4977. 0509    E Can't save or delete bookmarks at this terminal.                      
  4978. 0512    E Can't run &1 on this terminal.                                        
  4979. *                                                                               
  4980. 0510    I Saved &2 as &1.                                                       
  4981. 0514    E Return code &1 from &2.                                               
  4982. 0546    E Target not found.                                                     
  4983. 0571    I Created &1 from &2.                                                   
  4984. 0594    E File &1 already exists.                                               
  4985. *                                                                               
  4986. *601    R Enter specification list:                                             
  4987. 0601    R Enter keyword(s):                                                     
  4988. 0602    R Enter search string:;&1                                               
  4989. *                                                                               
  4990. * PFkey help lines                                                              
  4991. 0613  01  1= Help       2=           3= Return                                  
  4992. 0613  01     4= Print      5=          6= Find                                  
  4993. 0613  02  7= Backward   8= Forward   9= Bookmark                                
  4994. 0613  02  10= Booklist  11=         12= Quit                                    
  4995. 0614  01  1= Help       2=           3= Return                                  
  4996. 0614  01     4= Print      5=          6= Find                                  
  4997. 0614  02  7= Backward   8= Forward   9= Bookmark                                
  4998. 0614  02  10= Booklist  11= XEDIT   12= Quit                                    
  4999. 0615  01  1= Help       2=           3= Return                                  
  5000. 0615  01     4= Print      5=          6= Find                                  
  5001. 0615  02  7= Backward   8= Forward   9= Delete                                  
  5002. 0615  02    10= Refresh   11=         12= Quit                                  
  5003. *                                                                               
  5004. 0657    E Undefined PFkey/PAkey: &1                                             
  5005. 0696    W Invalid data received from the display.                               
  5006. *                                                                               
  5007. ************************************************************************        
  5008. *                                                                               
  5009. *   The range  652..907  (0..255 plus 700 minus 48)                             
  5010. *   is reserved for local language tags to gopher types.                        
  5011. *   (message numbers 0657 and 0696 violate this rule)                           
  5012. *                                                                               
  5013. *   Not all of these are official.   Not all of these will remain.              
  5014. *                                                                               
  5015. 0652    E type 0x00                                                             
  5016. 0653    E type 0x01                                                             
  5017. 0654    E type 0x02                                                             
  5018. 0655    E type 0x03                                                             
  5019. *                                                                               
  5020. * types represented by digits 0..9:                                             
  5021. 0700      <document>                                                            
  5022. 0701      <menu>                                                                
  5023. 0702      <phonebk>                                                             
  5024. 0703      <error>                                                               
  5025. 0704      <MAC>                                                                 
  5026. 0705      <DOS>                                                                 
  5027. 0706      <UUE>                                                                 
  5028. 0707      <search>                                                              
  5029. 0708      <telnet>                                                              
  5030. 0709      <binary>                                                              
  5031. *                                                                               
  5032. * types represented ASCII after digits:                                         
  5033. 0710      [Picture]                                                             
  5034. 0711      [Movie]                                                               
  5035. 0712      [Sound]                                                               
  5036. * (I wish they hadn't done this!)                                               
  5037. *                                                                               
  5038. 0717    E type "A"                                                              
  5039. 0718    E type "B"                                                              
  5040. 0719    E type "C"                                                              
  5041. 0720    E type "D"                                                              
  5042. 0721    E type "E"                                                              
  5043. 0722    E type "F"                                                              
  5044. 0723    E type "G"                                                              
  5045. 0724    E type "H"                                                              
  5046. 0725      <picture>                                                             
  5047. 0726    E type "J"                                                              
  5048. 0727    E type "K"                                                              
  5049. 0728    E type "L"                                                              
  5050. 0729      <MIME>                                                                
  5051. 0730    E type "N"                                                              
  5052. 0731    E type "O"                                                              
  5053. 0732    E type "P"                                                              
  5054. 0733    E type "Q"                                                              
  5055. 0734    E type "R"                                                              
  5056. 0735    E type "S"                                                              
  5057. 0736      <tn3270>                                                              
  5058. 0737    E type "U"                                                              
  5059. 0738    E type "V"                                                              
  5060. 0739    E type "W"                                                              
  5061. 0740    E type "X"                                                              
  5062. 0741    E type "Y"                                                              
  5063. 0742    E type "Z"                                                              
  5064. *                                                                               
  5065. 0749    E type "a"                                                              
  5066. 0750    E type "b"                                                              
  5067. 0751    E type "c"                                                              
  5068. 0752    E type "d"                                                              
  5069. 0753    E type "e"                                                              
  5070. 0754    E type "f"                                                              
  5071. 0755      <picture>                                                             
  5072. 0756    E type "h"                                                              
  5073. 0757      <info>                                                                
  5074. 0758    E type "j"                                                              
  5075. 0759    E type "k"                                                              
  5076. 0760    E type "l"                                                              
  5077. 0761    E type "m"                                                              
  5078. 0762    E type "n"                                                              
  5079. 0763    E type "o"                                                              
  5080. 0764    E type "p"                                                              
  5081. 0765    E type "q"                                                              
  5082. 0766      <record>                                                              
  5083. 0767      <sound>                                                               
  5084. 0768    E type "t"                                                              
  5085. 0769    E type "u"                                                              
  5086. 0770      <varrec>                                                              
  5087. 0771    E type "w"                                                              
  5088. 0772    E type "x"                                                              
  5089. 0773    E type "y"                                                              
  5090. 0774    E type "z"                                                              
  5091. *                                                                               
  5092. 0904    E type 0xFC                                                             
  5093. 0905    E type 0xFD                                                             
  5094. 0906    E type 0xFE                                                             
  5095. 0907    E type 0xFF                                                             
  5096. 0908    E type &1                                                               
  5097. *                                                                               
  5098. ************************************************************************        
  5099. *                                                                               
  5100. 0925    S I/O error on screen.                                                  
  5101. 0926    S CMS Gopher requires a display terminal.                               
  5102. *                                                                               
  5103. ************************************************************************        
  5104. *                                                                               
  5105. *xxx    I CMS Gopher 2.4.0 server                                               
  5106. *                                                                               
  5107. *         wd mm dd tm yy cl :   ...text...   path or user                       
  5108. 0120    I &1 &2 &3 &4 &5 &6 : Starting gopher daemon &7                         
  5109. 0121    I &1 &2 &3 &4 &5 &6 : Root Connection                                   
  5110. 0122    I &1 &2 &3 &4 &5 &6 : retrieved directory &7                            
  5111. 0123    I &1 &2 &3 &4 &5 &6 : retrieved file &7                                 
  5112. 0124    I &1 &2 &3 &4 &5 &6 : access restricted.                                
  5113. *                                                                               
  5114. 0125    E access restricted.                                                    
  5115. 2380    S You are not authorized to view this data.                             
  5116. *                                                                               
  5117. 0126    E Gopher TCP/IP service port must be numeric.                           
  5118. *                                                                               
  5119. ************************************************************************        
  5120. *                                                                               
  5121. * I "borrowed" the following strings from the UNIX curses client.               
  5122. * Some of these messages may show-up in CMS Gopher at some time.                
  5123. *                                                                               
  5124. * Press &1 for Help, &2 to Quit, &3 to go up a menu                             
  5125. * Page: &1/&2                                                                   
  5126. * Move To Line:                                                                 
  5127. * Search String:                                                                
  5128. * Search failed...                                                              
  5129. * Warning!!!!!, you are about to leave the Internet Gopher program              
  5130. *         and connect to another host.                                          
  5131. * If you get stuck press the control key and the ] key,                         
  5132. *         and then enter quit                                                   
  5133. * Now connecting to &1                                                          
  5134. * Use the account name "&1" to log in                                           
  5135. * Press return to connect, q to cancel:                                         
  5136. * Out of memory                                                                 
  5137. * Index word(s) to search for:                                                  
  5138. * Sorry, this machine doesn't support sounds                                    
  5139. * Couldn't make a tmp file!                                                     
  5140. * Problems Writing File                                                         
  5141. * Warning! File may be corrupt!                                                 
  5142. * File received successfully                                                    
  5143. * Couldn't unlink!!!                                                            
  5144. * Save in file:                                                                 
  5145. * Could not open file                                                           
  5146. * Connecting to server...                                                       
  5147. * Receiving file...                                                             
  5148. * Problems Writing                                                              
  5149. * Warning! File may be corrupt!                                                 
  5150. * File received successfully                                                    
  5151. * Cannot connect to host &1:                                                    
  5152. * Really quit (y/n) ?                                                           
  5153. * could not unlink &1                                                           
  5154. * I don't understand your terminal type                                         
  5155. * signal died:                                                                  
  5156. * Pager Command                                                                 
  5157. * Print Command                                                                 
  5158. * Telnet Command                                                                
  5159. * Sound Command                                                                 
  5160. * Mail Command                                                                  
  5161. * 3270 Emulator Command                                                         
  5162. * MIME pager                                                                    
  5163. * Image Viewer                                                                  
  5164. * Sorry, you are not allowed to set options in secure mode.                     
  5165. * Internet Gopher Options                                                       
  5166. * Usage: &1 [-sb] [-p path] [-t title] [hostname port]                          
  5167. * Root gopher server: &1                                                        
  5168. * &1: Nothing received for main menu, can't continue                            
  5169. * Strange Error occurred!                                                       
  5170. * No bookmarks are defined                                                      
  5171. * Bookmarks                                                                     
  5172. * Name for this bookmark?                                                       
  5173. * Sorry, can't make a bookmark of bookmarks                                     
  5174. * Sorry, can't delete top level directory.                                      
  5175. * Gopher Item Information                                                       
  5176. * Gopher Directory Information                                                  
  5177. * Searching Text...                                                             
  5178. * Connecting...                                                                 
  5179. * Retrieving Directory...                                                       
  5180. * Searching...                                                                  
  5181. * Nothing available.                                                            
  5182. * Receiving Information...                                                      
  5183. * Sorry, cannot transfer files in securemode                                    
  5184. * Receiving Directory...                                                        
  5185. * Searching Text...                                                             
  5186. * Receiving Sound...                                                            
  5187. * Receiving HTML page...                                                        
  5188. * Couldn't make a tmp file!                                                     
  5189. * Name=%s                                                                       
  5190. * Type=%c                                                                       
  5191. * Port=%d                                                                       
  5192. * Path=%s                                                                       
  5193. * Host=%s                                                                       
  5194. * Couldn't unlink!!!                                                            
  5195. * Internet Gopher Information Client v1.03                                      
  5196. * Press any key to return to gopher:                                            
  5197. * Out of memory!                                                                
  5198. * Mail document to:                                                             
  5199. * Address syntax rejected...                                                    
  5200. * Mailing File...                                                               
  5201. * builtin                                                                       
  5202. * Press <RETURN> to continue                                                    
  5203. * Saving File...                                                                
  5204. * Enter save file name:                                                         
  5205. * Error opening &1:  Enter new name or <Enter> to cancel:                       
  5206. * File cannot be opened!                                                        
  5207. * Press <RETURN> to exit                                                        
  5208. * Press 1-&1 to change a field, Return to accept fields                         
  5209. *         and continue                                                          
  5210. * Press Return when finished                                                    
  5211. * Press <ESC> to accept fields and continue                                     
  5212. * Press <ESC> to accept fields and continue                                     
  5213. * or press <CTRL-A> to abort                                                    
  5214. *         <press RETURN>                                                        
  5215. * Name                                                                          
  5216. * Phone                                                                         
  5217. * E-Mail                                                                        
  5218. * Address                                                                       
  5219. * name                                                                          
  5220. * phone                                                                         
  5221. * email                                                                         
  5222. * address                                                                       
  5223. * Data for Lines 1, 2, or 3 REQUIRED                                            
  5224. * query                                                                         
  5225. * Searching...                                                                  
  5226. * Couldn't make a tmp file!                                                     
  5227. * Couldn't unlink!!!                                                            
  5228. * unknown                                                                       
  5229. * -- press space for more --                                                    
  5230. * -- press space for more, use arrow keys to move,                              
  5231. *         '?' for help, 'q' to quit                                             
  5232. * Commands: Use arrow keys to move, '?' for help,                               
  5233. *         'q' to quit                                                           
  5234. * <Space> for next page                                                         
  5235. * bookmarks:                                                                    
  5236. * localhost                                                                     
  5237. * Bookmarks                                                                     
  5238. * Pagercmd:                                                                     
  5239. * Printercmd:                                                                   
  5240. * Telnetcmd:                                                                    
  5241. * Mailcmd:                                                                      
  5242. * Playcmd:                                                                      
  5243. * TN3270cmd:                                                                    
  5244. * MIMEcmd:                                                                      
  5245. * Imagecmd:                                                                     
  5246. * Aborting gopher configuration save!!                                          
  5247. * Can't write gopher configuration file!!                                       
  5248. * Pagercmd:                                                                     
  5249. * Printercmd:                                                                   
  5250. * Telnetcmd:                                                                    
  5251. * Mailcmd:                                                                      
  5252. * Playcmd:                                                                      
  5253. * TN3270cmd:                                                                    
  5254. * MIMEcmd:                                                                      
  5255. * Imagecmd:                                                                     
  5256. * bookmarks:                                                                    
  5257. * Termcap entry too long                                                        
  5258. * Bad termcap entry                                                             
  5259. * Infinite tc= loop                                                             
  5260. * Termcap entry too long                                                        
  5261. * Not owner                                                                     
  5262. * No such file or directory                                                     
  5263. * No such process                                                               
  5264. * Interrupted system call                                                       
  5265. * I/O error                                                                     
  5266. * No such device or address                                                     
  5267. * Arg list too long                                                             
  5268. * Exec format error                                                             
  5269. * Bad file number                                                               
  5270. * No children                                                                   
  5271. * No more processes                                                             
  5272. * Permission denied                                                             
  5273. * Bad address                                                                   
  5274. * Block device required                                                         
  5275. * Device busy                                                                   
  5276. * File exists                                                                   
  5277. * Cross-device link                                                             
  5278. * No such device                                                                
  5279. * Not a directory                                                               
  5280. * Is a directory                                                                
  5281. * Invalid argument                                                              
  5282. * File table overflow                                                           
  5283. * Too many open files                                                           
  5284. * Inappropriate ioctl for device                                                
  5285. * Text file busy                                                                
  5286. * File too large                                                                
  5287. * No space left on device                                                       
  5288. * Illegal seek                                                                  
  5289. * Read-only file system                                                         
  5290. * Too many links                                                                
  5291. * Broken pipe                                                                   
  5292. * Argument too large                                                            
  5293. * Result too large                                                              
  5294. * Operation would block                                                         
  5295. * Operation now in progress                                                     
  5296. * Operation already in progress                                                 
  5297. * Socket operation on non-socket                                                
  5298. * Destination address required                                                  
  5299. * Message too long                                                              
  5300. * Protocol wrong type for socket                                                
  5301. * Option not supported by protocol                                              
  5302. * Protocol not supported                                                        
  5303. * Socket type not supported                                                     
  5304. * Operation not supported on socket                                             
  5305. * Protocol family not supported                                                 
  5306. * Address family not supported by protocol family                               
  5307. * Address already in use                                                        
  5308. * Can't assign requested address                                                
  5309. * Network is down                                                               
  5310. * Network is unreachable                                                        
  5311. * Network dropped connection on reset                                           
  5312. * Software caused connection abort                                              
  5313. * Connection reset by peer                                                      
  5314. * No buffer space available                                                     
  5315. * Socket is already connected                                                   
  5316. * Socket is not connected                                                       
  5317. * Can't send after socket shutdown                                              
  5318. * Too many references: can't splice                                             
  5319. * Connection timed out                                                          
  5320. * Connection refused                                                            
  5321. * Too many levels of symbolic links                                             
  5322. * File name too long                                                            
  5323. * Host is down                                                                  
  5324. * Host is unreachable                                                           
  5325. * Directory not empty                                                           
  5326. * Too many processes                                                            
  5327. * Too many users                                                                
  5328. * Disc quota exceeded                                                           
  5329. * Stale NFS file handle                                                         
  5330. * Too many levels of remote in path                                             
  5331. * Not a stream device                                                           
  5332. * Timer expired                                                                 
  5333. * Out of stream resources                                                       
  5334. * No message of desired type                                                    
  5335. * Not a data message                                                            
  5336. * Identifier removed                                                            
  5337. * Deadlock situation detected/avoided                                           
  5338. * No record locks available                                                     
  5339. * Machine is not on the network                                                 
  5340. * Object is remote                                                              
  5341. * Link has been severed                                                         
  5342. * Advertise error                                                               
  5343. * Srmount error                                                                 
  5344. * Communication error on send                                                   
  5345. * Protocol error                                                                
  5346. * Multihop attempted                                                            
  5347. * Remote address changed                                                        
  5348. * Function not implemented                                                      
  5349. *                                                                               
  5350. ************************************************************************        
  5351. *                                                                               
  5352. 9999    I CMS Gopher message repository language: AMENG                         
  5353. * someone want to write  French, German, Italian, etc?                          
  5354. *                                                                               
  5355. :READ  GOPXEDPR XEDIT    A1 TMP200 01/12/93 16:26:39                            
  5356. /*                                                                              
  5357.  *        Name: GOPXEDPR XEDIT (was GOPHER XEDIT)                               
  5358.  *              a PROFILE for XEDIT when used as a Gopher file viewer           
  5359.  *      Author: Rick Troth, Rice University, Information Systems                
  5360.  *        Date: 1992-Dec-14                                                     
  5361.  *                                                                              
  5362.  *              When XEDIT is designated as the file viewer,  GOPHERCV          
  5363.  *              looks for GOPHER XEDIT.   If it exists,  it is used as          
  5364.  *              the XEDIT PROFILE;  otherwise,  you get your own.               
  5365.  *              In this example,  you get your own PROFILE,  with               
  5366.  *              the command  "MACRO ITEMINFO"  on the program stack.            
  5367.  */                                                                             
  5368.                                                                                 
  5369. Parse Arg string                                                                
  5370. Push "MACRO GOPXEDII"                                                           
  5371. Push "COMMAND SET SYNONYM ITEMINFO 4 GOPXEDII"                                  
  5372. Call PROFILE string                                                             
  5373. If Symbol(result) = "LIT" Then Result = 0                                       
  5374. Exit result                                                                     
  5375.                                                                                 
  5376. :READ  GOPXEDII XEDIT    A1 TMP200 12/18/92 13:48:36                            
  5377. /*                                                                              
  5378.  *        Name: GOPXEDII XEDIT (was ITEMINFO XEDIT)                             
  5379.  *              display gopher "item info" in the XEDIT message area            
  5380.  *      Author: Rick Troth, Rice University, Information Systems                
  5381.  *        Date: 1992-Dec-10                                                     
  5382.  *                                                                              
  5383.  *              This macro is part of CMS Gopher.                               
  5384.  */                                                                             
  5385.                                                                                 
  5386. Parse Source . . . . . arg0 .                                                   
  5387.                                                                                 
  5388. 'COMMAND CMS GLOBALV SELECT GOPHER GET PROGID'                                  
  5389. If progid = "" Then Do                                                          
  5390.     /*  You're not running CMS Gopher  */                                       
  5391.     'COMMAND CMS XMITMSG 542 ARG0 (VAR'                                         
  5392.     'EMSG' message.1                                                            
  5393.     Exit                                                                        
  5394.     End                                                                         
  5395.                                                                                 
  5396. 'COMMAND CMS GLOBALV SELECT GOPHER GET ITEM'                                    
  5397. Parse Var item . '05'x path '05'x host '05'x port '05'x .                       
  5398. If host ^= "" & port ^= "" & path ^= "" Then                                    
  5399.     'COMMAND MSG' host || ':' || port || ':' || path                            
  5400.                                                                                 
  5401. Exit                                                                            
  5402.                                                                                 
  5403. :READ  GOPHMARK EXEC     A1 TMP200 11/19/92 15:28:53                            
  5404. /*                                                                              
  5405.  *        Name: GOPHMARK EXEC                                                   
  5406.  *              Migrate CMS Gopher bookmarks from 2.3 to 2.4                    
  5407.  *      Author: Rick Troth, Rice University, Information Systems                
  5408.  *        Date: 1992-Nov-17                                                     
  5409.  */                                                                             
  5410.                                                                                 
  5411. 'GLOBALV SELECT GOPHER GET BOOKMARK.0'                                          
  5412. If Datatype(bookmark.0,'N') Then Exit                                           
  5413.                                                                                 
  5414. 'PIPE COMMAND GLOBALV SELECT GOPHMARK LIST' ,                                   
  5415.         '| DROP | STRIP LEADING | STEM MARK.'                                   
  5416.                                                                                 
  5417. Do i = 1 to mark.0                                                              
  5418.     Parse Var mark.i . '=' name '05'x host '05'x ,                              
  5419.     port '05'x path '05'x . '05'x type '05'x .                                  
  5420.     Select  /*  type  */                                                        
  5421.         When type = "file" Then type = 0                                        
  5422.         When type = "menu" Then type = 1                                        
  5423.         Otherwise               type = Left(path,1)                             
  5424.         End                                                                     
  5425.     bookmark.i = type || name || '05'x || path || '05'x || ,                    
  5426.                          host || '05'x || port                                  
  5427.     'GLOBALV SELECT GOPHER PUTP BOOKMARK.' || i                                 
  5428.     End                                                                         
  5429.                                                                                 
  5430. bookmark.0 = mark.0                                                             
  5431. 'GLOBALV SELECT GOPHER PUTP BOOKMARK.0'                                         
  5432.                                                                                 
  5433. :READ  PH       EXEC     A2 TMP200 01/14/93 05:50:02                            
  5434. /* ph exec - query name server for person.                    */                
  5435. /* Nick Laflamme - U. of Notre Dame                           */                
  5436. /* Dominique.P.Laflamme.1@nd.edu                              */                
  5437. /* UDM/Nick                                                   */                
  5438. /*                                                            */                
  5439. /* based heavily on GOPHER EXEC by Rick Troth, Rice U.        */                
  5440. /* which in turn relies heavily on Arty Ecoky's RXSOCKET      */                
  5441. /* May, 1992                                                  */                
  5442. /*      modified: June 4, 1992: add stack option                     */         
  5443. /*                also pull in improvements from FIXAFSID            */         
  5444. /*      modified: September 2, 1992: add UNIQUE, STACKALL, HOST, PORT*/         
  5445. /*                options, changed calling conventions.              */         
  5446. /* Last modified: December 4, 1992 - January 8, 1993: GLOBALV for    */         
  5447. /*                host, port, support for FIELDS and                 */         
  5448. /*                fill-in-the-blanks queries                         */         
  5449.                                                                                 
  5450. /* return codes:             */                                                 
  5451. /*  0: no problem            */                                                 
  5452. /*  1: no matches            */                                                 
  5453. /*  2: too many matches      */                                                 
  5454. /*  3: bad parameters        */                                                 
  5455. /*  4: no end of data?       */                                                 
  5456. /*  5: Read or Write failed  */                                                 
  5457. /*  6: internal error        */                                                 
  5458. /*  7: user signalled done   */                                                 
  5459. /*  8: not unique            */                                                 
  5460. /*100: incorrect use/environ */                                                 
  5461.                                                                                 
  5462. signal prologue                         /* skip to start of code      */        
  5463.                                                                                 
  5464. /* SYNTAX: and NOVALUE: come first so REXX can always find them       */        
  5465.                                                                                 
  5466. syntax:                                 /* in case of syntax error    */        
  5467. erc = rc                                /* preserve error code        */        
  5468. $error='REXX error' erc 'in line' sigl':' errortext(erc)                        
  5469. say $error                              /* get excited                */        
  5470. say "Line" sigl':' sourceline(sigl)     /* show offending line        */        
  5471. trace '?r'; nop                         /* start trace mode for debug */        
  5472. rc = Socket('Terminate')                                                        
  5473. exit erc                                                                        
  5474.                                                                                 
  5475. novalue:                                                                        
  5476. $error='Novalue error in line' sigl                                             
  5477. say $error                              /* get excited                */        
  5478. say sourceline(sigl)                    /* show offending line        */        
  5479. trace '?r'; nop                         /* start trace mode for debug */        
  5480. rc = Socket('Terminate')                                                        
  5481. exit 100                                                                        
  5482.                                                                                 
  5483. prologue:                               /* start of real code         */        
  5484. signal on novalue             /* complain about missing vairables     */        
  5485. signal on syntax              /* semi-graceful exit for syntax errors */        
  5486. parse source . invocation progfn progft progfm calledas addressee               
  5487.                                                                                 
  5488. parse arg wanthelp .          /* check first argument                 */        
  5489. select                                                                          
  5490. when wanthelp='?' then                                                          
  5491.  signal somehelp        /* break to explanation                 */              
  5492. when wanthelp='??' then                                                         
  5493.  signal morehelp        /* break to long explanation            */              
  5494. otherwise                                                                       
  5495.  nop                    /* on with life                         */              
  5496. end   /* of select on wanthelp      */                                          
  5497.                                                                                 
  5498. /* trace i */                                                                   
  5499.                                                                                 
  5500. /************* START OF CODE *************************/                         
  5501.                                                                                 
  5502. Address "COMMAND"                                                               
  5503.                                                                                 
  5504. progid = "CMS PH 1.98"           /* 2.00: GLOBALV, FIELDS, user input */        
  5505.                                                                                 
  5506. Signal on SYNTAX                                                                
  5507.                                                                                 
  5508. 'STATE RXSOCKET MODULE *'                                                       
  5509. If rc ^= 0 Then Do                                                              
  5510. Say "You must have RXSOCKET to run" progid                                      
  5511. Exit rc                                                                         
  5512. End  /*  If  ..  Do  */                                                         
  5513.                                                                                 
  5514. 'STATE TCPIP DATA *'                                                            
  5515. If rc ^= 0 Then Do                                                              
  5516. Say "You must have VM TCP/IP V2 accessed to run" progid                         
  5517. Exit rc                                                                         
  5518. End  /*  If  ..  Do  */                                                         
  5519.                                                                                 
  5520. 'STATE PIPE MODULE *'                                                           
  5521. If rc ^= 0 Then Do                                                              
  5522. Say "You must have CMS Pipelines to run" progid                                 
  5523. Exit rc                                                                         
  5524. End  /*  If  ..  Do  */                                                         
  5525.                                                                                 
  5526. HHOST = "ns.nd.edu"                                                             
  5527. HPORT = 105                                                                     
  5528. unique = 0                   /* by default, not looking for just one */         
  5529. stackall = 0                 /* by default, don't dump all to stack  */         
  5530. stack = 0                    /* not going for stacked output         */         
  5531. exitrc = 0                             /* optimistic default         */         
  5532.                                                                                 
  5533. /* Parse Arg whom "(" host hport "(" all */                                     
  5534. Parse Arg whom "(" optstring "(" whoops                                         
  5535. if whoops /= '' then                                                            
  5536. do                                                                              
  5537. say "Calling conventions have changed."                                         
  5538. exit 100                                                                        
  5539. end                                                                             
  5540. optstring = translate(optstring,' ','=') /* allow "=" as whitespace  */         
  5541. do while optstring /= ''                                                        
  5542. parse var optstring thisopt optstring                                           
  5543. select                                                                          
  5544. when translate(thisopt) = 'HOST' then                                           
  5545. parse var optstring hhost optstring                                             
  5546. when translate(thisopt) = 'PORT' then                                           
  5547. parse var optstring hport optstring                                             
  5548. when translate(thisopt) = 'UNIQUE' then                                         
  5549. do                                                                              
  5550. stack = 1                                                                       
  5551. unique = 1                                                                      
  5552. end                                                                             
  5553. when translate(thisopt) = 'STACK' then                                          
  5554. stack = 1                                                                       
  5555. when translate(thisopt) = 'STACKALL' then                                       
  5556. do                                                                              
  5557. stack = 1                                                                       
  5558. stackall = 1                                                                    
  5559. end                                                                             
  5560. otherwise                                                                       
  5561. say "Unknown option:" thisopt                                                   
  5562. end                                                      /* select */           
  5563. end                                 /* do while optstring isn't null */         
  5564.                                                                                 
  5565. helpstuff = '"Quit" means leave PH.  "Accept" means return this entry.'         
  5566. helpstuff = helpstuff '"Done" means leave PH and the calling program.'          
  5567.                                                                                 
  5568. /* now check global variables in case this is a Gopher-callee */                
  5569. 'GLOBALV SELECT PHCMS GET HOST PORT'                                            
  5570. if host = '' then                                                               
  5571. host = hhost                                                                    
  5572. if port /= '' then                                                              
  5573. do                                                                              
  5574. hport = port                                                                    
  5575. say hport c2d(hport)                                                            
  5576. end                                                                             
  5577. if hport /= strip(hport) then                                                   
  5578. do                                                                              
  5579. say 'Troth was right, I need a strip.'                                          
  5580. hport = strip(hport)                                                            
  5581. end                                                                             
  5582.                                                                                 
  5583. if index(host,'.') = 0 then                                                     
  5584. do                                                                              
  5585. if ^stack then                                                                  
  5586. say "Hostname" host "doesn't contain a period.  Is that correct?"               
  5587. exit 100                                                                        
  5588. end                                                                             
  5589. if datatype(hport,'W') = 0 then                                                 
  5590. do                                                                              
  5591. if ^stack then                                                                  
  5592. say hport "isn't a valid port number."                                          
  5593. exit 100                                                                        
  5594. end                                                                             
  5595.                                                                                 
  5596. /*                                                                              
  5597. **   Initialize RXSOCKET                                                        
  5598. */                                                                              
  5599.                                                                                 
  5600. maxdesc = Socket('Initialize', 'phCMS')                                         
  5601. If maxdesc="-1" Then                                                            
  5602. do                                                                              
  5603. if ^stack then                                                                  
  5604. say "INITIALIZE" errno                                                          
  5605. exit 5                                                                          
  5606. end                                                                             
  5607.                                                                                 
  5608. /* much of the following is copied from the RXSOCKET help files */              
  5609. s  = Socket('Socket', 'AF_INET', 'Sock_Stream')                                 
  5610. family  = AF_INET                                                               
  5611. port    = Htons(hport)                                                          
  5612.                                                                                 
  5613. /*                                                                              
  5614. **   Enable ASCII<->EBCDIC Translation Option                                   
  5615. */                                                                              
  5616. rc = Socket('SetSockOpt', s, 'SOL_SOCKET', 'SO_EBCDIC', 1)                      
  5617. If rc = "-1" Then                                                               
  5618. Do                                                                              
  5619. if ^stack then                                                                  
  5620. say "RXSOCKET subfunction SetSockOpt returned error" errno                      
  5621. exit 5                                                                          
  5622. End                                                                             
  5623.                                                                                 
  5624. Netaddr = Socket('GetHostByName', host)                                         
  5625. name    = family || port || netaddr                                             
  5626. Crc = Socket('Connect', s, name)                                                
  5627.                                                                                 
  5628. abort = 0                                                                       
  5629.                                                                                 
  5630. if whom = '' then                                                               
  5631. call get_target                                                                 
  5632. else                                                                            
  5633. data       = "query" whom||'0D25'x                                              
  5634.                                                                                 
  5635. if abort then /* from input screen */                                           
  5636. do                                                                              
  5637. rc = socket('Terminate')               /* ending early     */                   
  5638. exit 7                                                                          
  5639. end                                                                             
  5640.                                                                                 
  5641. bytes_sent = Socket('Write', s, data)                                           
  5642. if bytes_sent = -1 then                                                         
  5643. do                                                                              
  5644. if ^stack then                                                                  
  5645. say "Write failed.  Errno:" errno                                               
  5646. rc = Socket('Terminate')                                                        
  5647. exit 5                                                                          
  5648. end                                                                             
  5649. bytes_read = Socket('Read', s, 'buffer')                                        
  5650. if bytes_read = -1 then                                                         
  5651. do                                                                              
  5652. if ^stack then                                                                  
  5653. say "Read failed.  Errno:" errno                                                
  5654. rc = Socket('Terminate')                                                        
  5655. exit 5                                                                          
  5656. end                                                                             
  5657.                                                                                 
  5658. "PIPE (end \) var buffer ",                                                     
  5659. "| deblock linend 25 ",                                                         
  5660. "| stem rawdata.",                                                              
  5661. "| c: nfind 501:No matches to your query",                                      
  5662. "| d: nfind 502:Too many entries to prin",                                      
  5663. "| a: nfind 102",                                                               
  5664. "| b: nfind 200:Ok",                                                            
  5665. "| e: nfind 598:",                                                              
  5666. "| find 500:Did not understand query",                                          
  5667. "| f: faninany",                                                                
  5668. "| count lines",                                                                
  5669. "| var badquery",                                                               
  5670. "\ a:",                                                                         
  5671. "| specs word 3 1",                                                             
  5672. "| var howmany",                                                                
  5673. "\ b:",                                                                         
  5674. "| count lines",                                                                
  5675. "| var OK",                                                                     
  5676. "\ c:",                                                                         
  5677. "| count lines",                                                                
  5678. "| var NotFound",                                                               
  5679. "\ e:",                                                                         
  5680. "| f:",                                                                         
  5681. "\ d:",                                                                         
  5682. "| count lines",                                                                
  5683. "| var TooMany"                                                                 
  5684.                                                                                 
  5685. If NotFound then                                                                
  5686. do                                                                              
  5687. if ^stack then                                                                  
  5688. say "Nothing found for" whom                                                    
  5689. rc = Socket('Terminate')                                                        
  5690. exit 1                                                                          
  5691. end                                                                             
  5692.                                                                                 
  5693. If TooMany then                                                                 
  5694. do                                                                              
  5695. if ^stack then                                                                  
  5696. say "Too many matches for" whom||'; please be more selective.'                  
  5697. rc = Socket('Terminate')                                                        
  5698. exit 2                                                                          
  5699. end                                                                             
  5700.                                                                                 
  5701. If BadQuery then                                                                
  5702. do                                                                              
  5703. if ^stack then                                                                  
  5704. say "Query not resolved; possibly bad parameters."                              
  5705. rc = Socket('Terminate')                                                        
  5706. exit 3                                                                          
  5707. end                                                                             
  5708.                                                                                 
  5709. if OK < 1 then                                                                  
  5710. do                                                                              
  5711. /* try for repeated reads */                                                    
  5712. do while OK < 1                                                                 
  5713. bytes_read = Socket('Read', s, 'buffer2')                                       
  5714. if bytes_read = -1 then                                                         
  5715. do                                                                              
  5716. call qsay("Severe Error: Second read failed with ErrNo:" errno)                 
  5717. OK = 1 /* not!  but done anyway */                                              
  5718. exitrc = 5                                                                      
  5719. end                                                                             
  5720. else                                                                            
  5721. do                                                                              
  5722. "PIPE (end \) stem rawdata.",                                                   
  5723. "| a: fanin",                                                                   
  5724. "| stem rawdata.",                                                              
  5725. "| find 200:Ok",                                                                
  5726. "| count lines",                                                                
  5727. "| var OK",                                                                     
  5728. "\ var buffer2 ",                                                               
  5729. "| deblock linend 25 ",                                                         
  5730. "| a:"                                                                          
  5731. end                                                                             
  5732. end                                                                             
  5733. end                                                                             
  5734. /* hang up from application */                                                  
  5735. data       = "quit"||'0D25'x                                                    
  5736. bytes_sent = Socket('Write', s, data)                                           
  5737. /*                                                                              
  5738. **   Tell RXSOCKET that we are done with this IUCV path                         
  5739. */                                                                              
  5740. rc = Socket('Terminate')                                                        
  5741. If rc="-1" Then Call Error "TERMINATE", errno                                   
  5742.                                                                                 
  5743. if stackall then                                                                
  5744. do                                                                              
  5745. "PIPE stem rawdata. | stack" /* give it all */                                  
  5746. exit                                                                            
  5747. end                                                                             
  5748.                                                                                 
  5749. if unique then                                                                  
  5750. do                                                                              
  5751. if howmany = 1 then                                                             
  5752. "PIPE stem rawdata. | stack" /* give it all */                                  
  5753. else                                                                            
  5754. exitrc = 8                                                                      
  5755. exit exitrc                                                                     
  5756. end                                                                             
  5757.                                                                                 
  5758. do i = 1 to howmany                                                             
  5759. ph.i. = ''                           /* set default value          */           
  5760. "PIPE (name NewPH1) stem rawdata.",                                             
  5761. "| locate /:"||i||":/",                                                         
  5762. "| specs 9-* 1",                   /*    strip off line prefixes */             
  5763. "| strip trailing",                                                             
  5764. "| stem ph."||i||'.'                                                            
  5765. end                                                                             
  5766. ph.0 = howmany                                                                  
  5767.                                                                                 
  5768. /* set up windowing environment */                                              
  5769. "QUERY DISPLAY (LIFO"                                                           
  5770. parse pull . lines cols devtype addrtype dbcs color exthi pss pssets            
  5771. /* wlines = (lines * .75)%1                                                     
  5772. wcols = (cols * .75)%1                                                          
  5773. Wpsline = lines%8                                                               
  5774. Wpscol = cols%8 */                                                              
  5775. wlines = lines-2 /* allow for borders */                                        
  5776. wcols = cols - 4 /* allow for borders again */                                  
  5777. Wpsline = 2                                                                     
  5778. Wpscol = 3                                                                      
  5779. Vlines = wlines - 2                                                             
  5780. Vcols = wcols - 1                                                               
  5781. VProtTop = 1                          /* protected lines at top     */          
  5782. VProtBot = 1                          /* protected lines at bottom  */          
  5783. "WINDOW DEFINE  PH" Wlines Wcols Wpsline Wpscol "(BOR VAR"                      
  5784. "VSCREEN DEFINE PH" Vlines Vcols VProtTop VProtBot "(PROT"                      
  5785. "WINDOW SHOW PH ON PH"                                                          
  5786. "VMFCLEAR"                                                                      
  5787.                                                                                 
  5788. /* Now we start to display entries, one at a time. */                           
  5789. i=1                                                                             
  5790. done = 0                                                                        
  5791. parse var whom aa ' return ' .                                                  
  5792. do while ^done                                                                  
  5793. Ftitle = "PH Lookup Entry:" aa i "of" ph.0                                      
  5794. Flen   = length(Ftitle) + 1                                                     
  5795. Fcol   = (vcols-flen)%2                                                         
  5796. "VSCREEN WRITE PH 1" fcol flen "(RES HI PROT FIELD" Ftitle                      
  5797. if stack then                                                                   
  5798. select                                                                          
  5799. when ph.0 = 1 then                                                              
  5800. PFMenu = 'F1: Help F3: Quit F5: Accept                    F12: Done'            
  5801. when i = ph.0 then                                                              
  5802. PFMenu = 'F1: Help F3: Quit F5: Accept F7: Prior          F12: Done'            
  5803. when i = 1 then                                                                 
  5804. PFMenu = 'F1: Help F3: Quit F5: Accept           F8: Next F12: Done'            
  5805. otherwise                                                                       
  5806. PFMenu = 'F1: Help F3: Quit F5: Accept F7: Prior F8: Next F12: Done'            
  5807. end /* select */                                                                
  5808. else                                                                            
  5809. select                                                                          
  5810. when ph.0 = 1 then                                                              
  5811. PFMenu = 'F1: Help F3: Quit                              '                      
  5812. when i = ph.0 then                                                              
  5813. PFMenu = 'F1: Help F3: Quit            F7: Prior         '                      
  5814. when i = 1 then                                                                 
  5815. PFMenu = 'F1: Help F3: Quit                      F8: Next'                      
  5816. otherwise                                                                       
  5817. PFMenu = 'F1: Help F3: Quit            F7: Prior F8: Next'                      
  5818. end /* select */                                                                
  5819. "VSCREEN WRITE PH -1 1" length(pfmenu)+1 "(RES FIELD" PFMenu                    
  5820. do j = 1 to ph.i.0                                                              
  5821. "VSCREEN WRITE PH" j+1 1 length(ph.i.j)+1 "( HI PROT FIELD" ph.i.j              
  5822. end                                  /*    for each line of entry  */           
  5823.                                                                                 
  5824. if ph.i.0 = 0 then                                                              
  5825. do                                                                              
  5826. if ^stack then                                                                  
  5827. call qsay("Severe Error: 0 fields present for" i)                               
  5828. abort = 1                                /* ending early     */                 
  5829. done = 1                                                                        
  5830. exitrc = 6                                                                      
  5831. leave                                                                           
  5832. end                                                                             
  5833. else                                                                            
  5834. "VSCREEN WAITREAD PH"              /* wait for user input        */             
  5835. /* now waitread.0 is the variable count,                           */           
  5836. /* waitread.1 is the attention key just used,                      */           
  5837. /* waitread.2 is the cursor position.                              */           
  5838. /* all variables after those are changed fields.                   */           
  5839.                                                                                 
  5840. parse var waitread.1 ktype num                                                  
  5841. select                                                                          
  5842. when (ktype = "PFKEY") & (find("1 13",num) /= 0) then                           
  5843. call qsay(helpstuff)                                                            
  5844. when (ktype = "PFKEY") & (find("5 17",num) /= 0) then                           
  5845. done = 1                                                                        
  5846. when (ktype = "PFKEY") & (find("3 15",num) /= 0) then                           
  5847. do                                                                              
  5848. abort = 1                              /* ending early     */                   
  5849. done = 1                                                                        
  5850. end                                                                             
  5851. when (ktype = "PFKEY") & (find("12 24",num) /= 0) then                          
  5852. do                                                                              
  5853. abort = 1                              /* ending early     */                   
  5854. done = 1                                                                        
  5855. if stack then                                                                   
  5856. exitrc = 7                             /* really quit      */                   
  5857. end                                                                             
  5858. when (ktype = "PFKEY") & (find("7 19",num) /= 0) then                           
  5859. do                                                                              
  5860. if i > 1 then                                                                   
  5861. i = i-1                                                                         
  5862. else                                                                            
  5863. call qsay("Already at the first entry.")                                        
  5864. end                                                                             
  5865. when (ktype = "PFKEY") & (find("8 20",num) /= 0) then                           
  5866. do                                                                              
  5867. if i < ph.0 then                                                                
  5868. i = i+1                                                                         
  5869. else                                                                            
  5870. call qsay("That's the last entry.")                                             
  5871. end                                                                             
  5872. when ktype = "PFKEY" then                                                       
  5873. call qsay("PFKey" num "was used.  That's fine, nothing wrong",                  
  5874. "with that, it just doesn't do anything special. ")                             
  5875. otherwise                                                                       
  5876. nop                                      /* no biggie        */                 
  5877. end                                                                             
  5878. if done & ^abort then              /* we have a winner....       */             
  5879. if stack then                                                                   
  5880. "PIPE STEM PH.I. | stack LIFO"                                                  
  5881.                                                                                 
  5882. "VSCREEN CLEAR PH"                                                              
  5883.                                                                                 
  5884. end                                    /* wander through entries     */         
  5885.                                                                                 
  5886. "WINDOW  DELETE PH"                                                             
  5887. "VSCREEN DELETE PH"                                                             
  5888.                                                                                 
  5889. Exit exitrc                                                                     
  5890.                                                                                 
  5891. somehelp:                                                                       
  5892. say 'Give a name and get local directory information.'                          
  5893. exit 100                      /* non-zero RC for explanation mode     */        
  5894.                                                                                 
  5895. morehelp:                                                                       
  5896. say 'Give a name and get local directory information.'                          
  5897. say 'By default, it looks for you and returns brief information from'           
  5898. say 'Notre Dame.  Options include who you are looking for, where from,'         
  5899. say 'and if you want all the server knows about the person.'                    
  5900. say 'Use "*" as the wildcard character.'                                        
  5901. say ''                                                                          
  5902. say 'Specify HOST by name, PORT by decimal number.  STACK, STACKALL,'           
  5903. say 'and UNIQUE are other CMS programs to use.'                                 
  5904. say 'Syntax:' progfn '{whom} {( {HOST host} {PORT port}'                        
  5905. say             '{STACK|STACKALL|UNIQUE} }'                                     
  5906. exit 100                                                                        
  5907.                                                                                 
  5908.                                                                                 
  5909. Qsay:                        /* cheap SAY command for fullscreen     */         
  5910. procedure                                                                       
  5911. parse arg message                                                               
  5912.                                                                                 
  5913. "QUERY DISPLAY (LIFO"                                                           
  5914. parse pull . lines cols devtype addrtype dbcs color exthi pss pssets            
  5915. wlines = (lines * .75)%1                                                        
  5916. wcols = (cols * .75)%1                                                          
  5917. Wpsline = lines%8                                                               
  5918. Wpscol = cols%8                                                                 
  5919. Vlines = wlines - 2                                                             
  5920. Vcols = wcols - 1                                                               
  5921. VProtTop = 1                          /* protected lines at top     */          
  5922. VProtBot = 1                          /* protected lines at bottom  */          
  5923. "WINDOW DEFINE  QUICKIE" Wlines Wcols Wpsline Wpscol "(BOR VAR"                 
  5924. "VSCREEN DEFINE QUICKIE" Vlines Vcols VProtTop VProtBot "(PROT"                 
  5925. "WINDOW SHOW QUICKIE ON QUICKIE"                                                
  5926. PFMenu = 'Hit <ENTER> to Continue'                                              
  5927. a=(vcols-length(pfmenu))%2                                                      
  5928. "VSCREEN WRITE QUICKIE -1" a length(PFMenu)+1 "(RES FIELD" PFMenu               
  5929. fields = 1                                                                      
  5930. Field.Row.1   = 1                                                               
  5931. Field.title.1 = "Quick Message"                                                 
  5932. Field.len.1   = length(Field.title.1) + 1                                       
  5933. Field.col.1   = (vcols-field.len.1)%2                                           
  5934. Field.opts.1  = "HI PROT"                                                       
  5935.                                                                                 
  5936. parse var message nextword message                                              
  5937. fields = fields + 1                                                             
  5938. field.title.fields = ''                                                         
  5939.                                                                                 
  5940. do while nextword ^= ''                                                         
  5941. if length(nextword) > vcols then                                                
  5942. do                                                                              
  5943. say "Too long word:" nextword                                                   
  5944. say "No message sent."                                                          
  5945. return                                                                          
  5946. end                                                                             
  5947. if length(nextword) + length(field.title.fields) < vcols then                   
  5948. do                                                                              
  5949. field.title.fields = field.title.fields nextword                                
  5950. parse var message nextword message                                              
  5951. end                                                                             
  5952. else                                                                            
  5953. do                                                                              
  5954. fields = fields+1                                                               
  5955. field.title.fields = ''                                                         
  5956. end                                                                             
  5957. end                                                                             
  5958. do i = 2 to fields                                                              
  5959. Field.Row.i   = i                                                               
  5960. Field.len.i   = length(Field.title.i) + 1                                       
  5961. Field.col.i   = 1                                                               
  5962. Field.opts.i  = "HI PROT"                                                       
  5963. end                                                                             
  5964.                                                                                 
  5965. do i = 1 to fields                                                              
  5966. "VSCREEN WRITE QUICKIE"  Field.row.i Field.col.i Field.len.i,                   
  5967.     "(" Field.opts.i "FIELD" Field.title.i                                      
  5968. if length(field.title.i) >= field.len.i then                                    
  5969. say "Trouble: field" i                                                          
  5970. end                                                                             
  5971. "VSCREEN WAITREAD QUICKIE"           /* wait for user input        */           
  5972.                                                                                 
  5973. "VSCREEN CLEAR QUICKIE"                                                         
  5974. "WINDOW  DELETE QUICKIE"                                                        
  5975. "VSCREEN DELETE QUICKIE"                                                        
  5976.                                                                                 
  5977. return                                                                          
  5978.                                                                                 
  5979. get_target:                                                                     
  5980.                                                                                 
  5981. data       = 'fields'||'0D25'x                                                  
  5982. bytes_sent = Socket('Write', s, data)                                           
  5983. if bytes_sent = -1 then                                                         
  5984. do                                                                              
  5985. say "Write failed.  Errno:" errno                                               
  5986. rc = Socket('Terminate')                                                        
  5987. exit 5                                                                          
  5988. end                                                                             
  5989. bytes_read = Socket('Read', s, 'buffer')                                        
  5990. if bytes_read = -1 then                                                         
  5991. do                                                                              
  5992. say "Read failed.  Errno:" errno                                                
  5993. rc = Socket('Terminate')                                                        
  5994. exit 5                                                                          
  5995. end                                                                             
  5996.                                                                                 
  5997. "PIPE (end \) var buffer ",                                                     
  5998. "| deblock linend 25 ",                                                         
  5999. "| stem rawdata.",                                                              
  6000. "| b: nfind 200:Ok",                                                            
  6001. "| e: nfind 598:",                                                              
  6002. "| find 500:Did not understand query",                                          
  6003. "| f: faninany",                                                                
  6004. "| count lines",                                                                
  6005. "| var badquery",                                                               
  6006. "\ b:",                                                                         
  6007. "| count lines",                                                                
  6008. "| var OK",                                                                     
  6009. "\ e:",                                                                         
  6010. "| f:"                                                                          
  6011.                                                                                 
  6012. If BadQuery then                                                                
  6013. do                                                                              
  6014. say "Severe error: fields query failed."                                        
  6015. exit 3                                                                          
  6016. end                                                                             
  6017.                                                                                 
  6018. if OK < 1 then                                                                  
  6019. do                                                                              
  6020. /* try for repeated reads */                                                    
  6021. do while OK < 1                                                                 
  6022. bytes_read = Socket('Read', s, 'buffer2')                                       
  6023. if bytes_read = -1 then                                                         
  6024. do                                                                              
  6025. say "Severe Error: Second read failed with ErrNo:" errno                        
  6026. ok = 1 /* not!, but done anyway */                                              
  6027. exitrc = 5                                                                      
  6028. end                                                                             
  6029. else                                                                            
  6030. do                                                                              
  6031. "PIPE (end \) stem rawdata.",                                                   
  6032. "| a: fanin",                                                                   
  6033. "| stem rawdata.",                                                              
  6034. "| find 200:Ok",                                                                
  6035. "| count lines",                                                                
  6036. "| var OK",                                                                     
  6037. "\ var buffer2 ",                                                               
  6038. "| deblock linend 25 ",                                                         
  6039. "| a:"                                                                          
  6040. end                                                                             
  6041. end                                                                             
  6042. end                                                                             
  6043.                                                                                 
  6044. /* display code goes here. */                                                   
  6045. do i = 1 to rawdata.0                                                           
  6046. parse var rawdata.i msg ':' id ':' stuff                                        
  6047. rawdata.i = msg||':'||right(id,2,'0')||":" stuff                                
  6048. end                                                                             
  6049. 'PIPE (end \) stem rawdata. ',                                                  
  6050. '| sort 1.8',                                                                   
  6051. '| a: unique 1.8 first',                                                        
  6052. '| locate /Public/',                                                            
  6053. '| locate /Indexed/',                                                           
  6054. '| buffer', /* when in doubt.... */                                             
  6055. '| b: lookup 1.8 master',                                                       
  6056. '| specs 10-* 1',                                                               
  6057. '| split /:/',                                                                  
  6058. '| pad 10',                                                                     
  6059. '| join',                                                                       
  6060. '| stem indices.',                                                              
  6061. '\ a:',                                                                         
  6062. '| buffer', /* when in doubt.... */                                             
  6063. '| b:',                                                                         
  6064. '| hole'                                                                        
  6065.                                                                                 
  6066. stuff.1 = 'Your query must include one of the following keys and'               
  6067. stuff.2 = '(probably) by default implies "name =" unless you specify'           
  6068. stuff.3 = 'the keys yourself:'                                                  
  6069. stuff.1='Type the name (first, last, nickname or a combination) of the'         
  6070. stuff.2='person you wish to look up.'                                           
  6071. stuff.3=''                                                                      
  6072. stuff.4="Or, for lookups involving information other than the person's"         
  6073. stuff.5="name, use the following keywords:"                                     
  6074. do i = 1 to indices.0                                                           
  6075. j = i+5                                                                         
  6076. stuff.j = indices.i                                                             
  6077. end                                                                             
  6078. stuff.0 = 3+indices.0                                                           
  6079.                                                                                 
  6080. "QUERY DISPLAY (LIFO"                                                           
  6081. parse pull . lines cols devtype addrtype dbcs color exthi pss pssets            
  6082. Pscreen = "PHCMSQ"                                                              
  6083. Pwindow = "PHCMSQ"                                                              
  6084. Wlines = lines - 4                                                              
  6085. Wcols = cols - 4                                                                
  6086. Wpsline = 3                                                                     
  6087. Wpscol = 3                                                                      
  6088. Vlines = wlines - 1                                                             
  6089. Vcols = wcols - 1                                                               
  6090. VProtTop = 1                           /* protected lines at top     */         
  6091. VProtBot = 1                           /* protected lines at bottom  */         
  6092.                                                                                 
  6093. "VMFCLEAR"                   /* clear the screen if possible/easy    */         
  6094. "WINDOW DEFINE"  Pwindow Wlines Wcols Wpsline Wpscol "(BOR VAR"                 
  6095. "VSCREEN DEFINE" Pscreen Vlines Vcols VProtTop VProtBot "(PROT"                 
  6096. "WINDOW SHOW" Pwindow "ON" Pscreen                                              
  6097. PFMenu = 'PF Keys: 3: Quit  5: Go 12: Quit'                                     
  6098. "VSCREEN WRITE" Pscreen  "-1 1" length(PFMenu)+1 "(RES FIELD" PFMenu            
  6099.                                                                                 
  6100. fields = 3 + stuff.0         /* count of currently known fields      */         
  6101. done = 0                                                                        
  6102. abort = 0                                                                       
  6103. qpt1 = ''                                                                       
  6104. qpt2 = ''                                                                       
  6105.                                                                                 
  6106. do i = 1 to fields                                                              
  6107. Field.opts.i = 'PROTECT'                                                        
  6108. Field.change.i = 1         /* write all lines to ensure state.     */           
  6109. end                                                                             
  6110. /* now define fields to be used later.                               */         
  6111. Field.Row.1   = 1                                                               
  6112. Field.title.1 = "PH Input Screen"                                               
  6113. Field.len.1   = length(Field.title.1) + 1                                       
  6114. Field.col.1   = (cols-Field.len.1)%2                                            
  6115. Field.opts.1 = "RES NOHIGH PROTECT"                                             
  6116.                                                                                 
  6117. Field.row.2   = 3                                                               
  6118. Field.col.2   = 3                                                               
  6119. Field.title.2 = left(qpt1,65,' ')                                               
  6120. Field.len.2   = length(Field.title.2) + 1                                       
  6121. Field.opts.2 = "NOHIGH NOPROTECT"                                               
  6122.                                                                                 
  6123. Field.row.3   = 4                                                               
  6124. Field.col.3   = 3                                                               
  6125. Field.len.3   = 66                                                              
  6126. Field.title.3 = copies(' ',65)                                                  
  6127. Field.opts.3 = "NOHIGH NOPROTECT"                                               
  6128.                                                                                 
  6129. lastrow = 5  /* don't write message lines in row 5 or above. */                 
  6130.                                                                                 
  6131. do i = 1 to stuff.0                                                             
  6132. lastrow = lastrow + 1                                                           
  6133. j = i+3                                                                         
  6134. Field.row.j = lastrow                                                           
  6135. Field.col.j = 3                                                                 
  6136. Field.Title.j = stuff.i                                                         
  6137. Field.len.j = length(stuff.i) + 1                                               
  6138. Field.opts.j = "PROTECT HIGH"                                                   
  6139. end                                                                             
  6140.                                                                                 
  6141. /* Set the initial cursor position */                                           
  6142. CurPosRow = Field.row.2                /* start on first query field */         
  6143. CurPosCol = Field.col.2 + 1                                                     
  6144.                                                                                 
  6145. do while done /= 1                                                              
  6146. do i = 1 to fields                                                              
  6147. if Field.change.i then                                                          
  6148. do                                                                              
  6149. if Field.title.i = '' then                                                      
  6150. "VSCREEN WRITE" Pscreen  Field.row.i Field.col.i Field.len.i,                   
  6151. "(" Field.opts.i                                                                
  6152. else                                                                            
  6153. "VSCREEN WRITE" Pscreen  Field.row.i Field.col.i Field.len.i,                   
  6154. "(" Field.opts.i "FIELD" Field.title.i                                          
  6155. Field.change.i = 0              /* Reset flag                 */                
  6156. if length(field.title.i) >= field.len.i then                                    
  6157. say "Trouble: field" i                                                          
  6158. end                                                                             
  6159. end                                                                             
  6160.                                                                                 
  6161. "VSCREEN CURSOR" Pscreen CurPosRow  CurPosCol                                   
  6162. "VSCREEN WAITREAD" Pscreen           /* wait for user input        */           
  6163. /* now waitread.0 is the variable count,                           */           
  6164. /* waitread.1 is the attention key just used,                      */           
  6165. /* waitread.2 is the cursor position.                              */           
  6166. /* all variables after those are changed fields.                   */           
  6167. parse var waitread.1 ktype num                                                  
  6168. if ktype = "PFKEY" & find("3 12 15 24",num) /= 0 then                           
  6169. do                                                                              
  6170. abort = 1                                  /* ending early     */               
  6171. done = 1                                                                        
  6172. leave  /* don't process changes      */                                         
  6173. end                                                                             
  6174. if ktype = "CLEAR" then                                                         
  6175. do                                                                              
  6176. abort = 1                                  /* ending early     */               
  6177. done = 1                                                                        
  6178. leave  /* don't process changes      */                                         
  6179. end                                                                             
  6180. if ktype = "PFKEY" & find("5 17",num) /= 0 then                                 
  6181. done = 1                                                                        
  6182. if ktype = "ENTER" then                                                         
  6183. done = 1                                                                        
  6184.                                                                                 
  6185. parse var waitread.2 . CurPosRow CurPosCol .                                    
  6186.                                                                                 
  6187. DO varcount= 3 to waitread.0                   /* changed fields   */           
  6188. PARSE VAR waitread.varcount KWord ChngRow ChngCol NewVal                        
  6189. SELECT                                                                          
  6190. WHEN ChngRow= 3 THEN                            /* query pt 1  */               
  6191. DO                                                                              
  6192. qpt1 = NewVal                                                                   
  6193. field.change.2 = 1                                                              
  6194. field.title.2 = qpt1                                                            
  6195. End                                                                             
  6196. WHEN ChngRow= 4 THEN                           /* query part 2 */               
  6197. DO                                                                              
  6198. qpt2 = NewVal                                                                   
  6199. field.change.3 = 1                                                              
  6200. field.title.3 = qpt2                                                            
  6201. End                                                                             
  6202. OTHERWISE                                                                       
  6203. say "Error: unrecognized changed field."                                        
  6204. say waitread.varcount                                                           
  6205. END  /* select on changed fields   */                                           
  6206. END  /* parse changed fields       */                                           
  6207. end  /* do while not done loop               */                                 
  6208. "VSCREEN CLEAR"  Pscreen                                                        
  6209. "WINDOW  DELETE" Pwindow                                                        
  6210. "VSCREEN DELETE" Pscreen                                                        
  6211.                                                                                 
  6212. whom = strip(qpt1) strip(qpt2)                                                  
  6213. data = 'query' whom||'0D25'x                                                    
  6214.                                                                                 
  6215. return                                                                          
  6216. :READ  GL       EXEC     A1 TMP200 06/29/92 10:24:28                            
  6217. /*                                                                              
  6218.  *        Name: GL EXEC, Gopher Tree Traverser (Gopher List)                    
  6219.  *      Author: Rick Troth, Rice University, I/S VM Systems Support             
  6220.  *        Date: 1992-Feb-22, Jun-29                                             
  6221.  *                                                                              
  6222.  *        Note: Think of this as a FILELIST replacement.                        
  6223.  *              Actually, it doesn't replace,  but wraps around                 
  6224.  *              FILELIST,  resetting PF11 from XEDIT to EXEC GL.                
  6225.  *              When GL is invoked on a FILELIST,  it calls FILELIST;           
  6226.  *              when GL is invoked on any other file,  it calls XEDIT.          
  6227.  */                                                                             
  6228.                                                                                 
  6229. Address "COMMAND"                                                               
  6230.                                                                                 
  6231. Parse Upper Arg fn ft fm rest                                                   
  6232. If fn ^= "" & ft = "" Then ft = "FILELIST"                                      
  6233.                                                                                 
  6234. If ft = "FILELIST" Then Do                                                      
  6235.     Push "COMMAND SET PF11 BEFORE MACRO" ,                                      
  6236.         "EXECUTE CURSOR EXEC GL /"                                              
  6237.     'EXEC FILELIST' fn ft fm '(FILELIST'                                        
  6238.     End                                                                         
  6239.                                                                                 
  6240. Else 'XEDIT' fn ft fm rest                                                      
  6241.                                                                                 
  6242. Exit rc                                                                         
  6243.                                                                                 
  6244. :READ  GOPHERCA EXEC     A1 TMP200 01/05/93 17:58:01                            
  6245. /*                                                                              
  6246.  *        Name: GOPHERCAT EXEC                                                  
  6247.  *                                                                              
  6248.  *        Date: 1993-Jan-05                                                     
  6249.  *    See also: gophercat (perl script) by Prentiss Riddle                      
  6250.  */                                                                             
  6251.                                                                                 
  6252. Address "COMMAND"                                                               
  6253.                                                                                 
  6254. 'SET LANGUAGE (ADD GOP USER'                                                    
  6255.                                                                                 
  6256. Parse Arg host port path '(' . ')' .                                            
  6257.                                                                                 
  6258. Parse Var path 1 type 2 slash 3 .                                               
  6259. If slash ^= '/' Then Do                                                         
  6260.     type = '0'                                                                  
  6261.     path = "0/" || path                                                         
  6262.     End  /*  If  ..  Do  */                                                     
  6263.                                                                                 
  6264. item = type || '05'x || path || '05'x ,                                         
  6265.             || host || '05'x || port                                            
  6266.                                                                                 
  6267. If type = '0' | type = '1' Then                                                 
  6268. 'PIPE VAR ITEM | GOPCLTCP | GOPCLTXT | CONSOLE'                                 
  6269. Else                                                                            
  6270. 'PIPE VAR ITEM | GOPCLTCP | CONSOLE'                                            
  6271.                                                                                 
  6272. Exit rc                                                                         
  6273.                                                                                 
  6274. :READ  GOPGEN   EXEC     A1 TMP200 01/25/93 15:37:32                            
  6275. /*                                                                              
  6276.  *        Name: GOPGEN EXEC                                                     
  6277.  *              Generate files used by the CMS Gopher server                    
  6278.  *      Author: Rick Troth, Rice University, Information Systems                
  6279.  *        Date: 1993-Jan-22                                                     
  6280.  */                                                                             
  6281.                                                                                 
  6282. Parse Upper Arg what args '(' opts ')' .                                        
  6283.                                                                                 
  6284. Select  /*  what  */                                                            
  6285.                                                                                 
  6286.     When  Abbrev("INDEX",what,1)    Then  Signal  INDEX                         
  6287.     When  Abbrev("MESSAGES",what,1) Then  Signal  MESSAGES                      
  6288.     When  Abbrev("MSGS",what,1)     Then  Signal  MESSAGES                      
  6289.     When  Left(what,6) = "GOPCLI"   Then  Signal  REXX                          
  6290.     When  Left(what,6) = "GOPSRV"   Then  Signal  REXX                          
  6291.     When  Abbrev("EDIT",what,1)     Then  Signal  EDIT                          
  6292.                                                                                 
  6293.     Otherwise Do                                                                
  6294.         'XMITMSG 3 WHAT (ERRMSG'                                                
  6295.         rc = 24                                                                 
  6296.         End  /*  Otherwise  Do  */                                              
  6297.                                                                                 
  6298.     End  /*  Select  what */                                                    
  6299.                                                                                 
  6300. Exit rc                                                                         
  6301.                                                                                 
  6302.                                                                                 
  6303.                                                                                 
  6304. /* ------------------------------------------------------------ MESSAGES        
  6305.  */                                                                             
  6306. MESSAGES:                                                                       
  6307.                                                                                 
  6308. Parse Var args lang .                                                           
  6309. If lang = "" Then ft = "MESSAGES"                                               
  6310.              Else ft = "MSG" || lang                                            
  6311.                                                                                 
  6312. Address "CMS" 'STATE GOPUME' ft '*'                                             
  6313. 'PIPE COMMAND LISTFILE GOPUME' ft '* (NOHEADER | TAKE | VAR FILESPEC'           
  6314. If rc ^= 0 Then Return                                                          
  6315. Parse Var filespec . ft fm .                                                    
  6316.                                                                                 
  6317. 'GENMSG GOPUME' ft fm 'GOP' lang '(NOLIST'                                      
  6318. If rc ^= 0 Then Return                                                          
  6319.                                                                                 
  6320. If lang ^= "" Then Do                                                           
  6321.     Address "COMMAND" 'STATE GOPUME TEXT' fm                                    
  6322.     If rc ^= 0 Then Return                                                      
  6323.     ft = "TXT" || lang                                                          
  6324.     'ERASE GOPUME' ft fm                                                        
  6325.     If rc ^= 0 Then Return                                                      
  6326.     'RENAME GOPUME TEXT' fm '=' ft fm                                           
  6327.     If rc ^= 0 Then Return                                                      
  6328.     End  /*  If  ..  Do  */                                                     
  6329.                                                                                 
  6330. 'SET LANG' lang '(ADD GOP USER'                                                 
  6331. If rc ^= 0 Then Return                                                          
  6332. 'XMITMSG 9999 (APPLID GOP CALLER GEN ERRMSG'                                    
  6333.                                                                                 
  6334. Return                                                                          
  6335.                                                                                 
  6336.                                                                                 
  6337.                                                                                 
  6338. /* --------------------------------------------------------------- INDEX        
  6339.  */                                                                             
  6340. INDEX:                                                                          
  6341.                                                                                 
  6342. Parse Var args menu .                                                           
  6343. 'PIPE GOPSRVLS' menu '| GOPGENFL | > VMGOPHER FILELIST A'                       
  6344. If rc ^= 0 Then Return                                                          
  6345. Say 'WISHLG' menu 'FILELIST A' menu 'GOPINDEX A'                                
  6346. 'WISHLG VMGOPHER FILELIST A' menu 'GOPINDEX A'                                  
  6347. If rc ^= 0 Then Return                                                          
  6348. 'ERASE VMGOPHER FILELIST A'                                                     
  6349. If rc ^= 0 Then Return                                                          
  6350.                                                                                 
  6351. /*  menu "index created"  */                                                    
  6352. /*  'XMITMSG ??? MENU (APPLID GOP CALLER GEN ERRMSG'  */                        
  6353.                                                                                 
  6354. Return                                                                          
  6355.                                                                                 
  6356.                                                                                 
  6357.                                                                                 
  6358. /* ---------------------------------------------------------------- REXX        
  6359.  */                                                                             
  6360. REXX:                                                                           
  6361.                                                                                 
  6362. Parse Var args fn ft .                                                          
  6363. 'EXEC EXECUPDT' fn ft '(CTL VMGOPHER'                                           
  6364.                                                                                 
  6365. Return                                                                          
  6366.                                                                                 
  6367.                                                                                 
  6368.                                                                                 
  6369. /* ---------------------------------------------------------------- EDIT        
  6370.  */                                                                             
  6371. EDIT:                                                                           
  6372.                                                                                 
  6373. Parse Var args fn ft fm .                                                       
  6374. 'XEDIT' fn '$' || ft fm '(CTL VMGOPHER'                                         
  6375.                                                                                 
  6376. Return                                                                          
  6377.                                                                                 
  6378. :READ  GOPGENFL REXX     A1 TMP200 01/22/93 10:25:19                            
  6379. /*                                                                              
  6380.  *        Name: GOPGENFL REXX                                                   
  6381.  *      Author: Rick Troth, Rice University, Information Systems                
  6382.  *        Date: 1993-Jan-22                                                     
  6383.  *                                                                              
  6384.  *       Input: FILELIST records, comments allowed                              
  6385.  *      Output: WISHLG input FILELIST records, comments stripped,               
  6386.  *              title appended to each record that lacked                       
  6387.  *    Calld by: GOPGEN EXEC via PIPE                                            
  6388.  */                                                                             
  6389.                                                                                 
  6390. uc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"                                               
  6391. lc = "abcdefghijklmnopqrstuvwxyz"                                               
  6392.                                                                                 
  6393. Do Forever                                                                      
  6394.                                                                                 
  6395.     'PEEKTO RECORD'                                                             
  6396.     If rc ^= 0 Then Leave                                                       
  6397.                                                                                 
  6398.     If Left(record,1) = ' ' Then Do                                             
  6399.         Parse Var record fn ft fm title                                         
  6400.         If title = "" Then 'OUTPUT' record Translate(fn||'.'||ft,lc,uc)         
  6401.                       Else 'OUTPUT' record                                      
  6402.         If rc ^= 0 Then Leave                                                   
  6403.         End  /*  If  ..  Do  */                                                 
  6404.                                                                                 
  6405.     'READTO'                                                                    
  6406.     If rc ^= 0 Then Leave                                                       
  6407.                                                                                 
  6408.     End  /*  Do  Forever  */                                                    
  6409.                                                                                 
  6410. Exit rc * (rc ^= 12)                                                            
  6411.                                                                                 
  6412. :READ  GOPHER   HELPCMS  A1 TMP200 01/12/93 19:32:06                            
  6413. .cm This CMS HELP file created by hand - RMT                                    
  6414. .cm                                                                             
  6415.                                                                                 
  6416. GOPHER EXEC                                                                     
  6417.                                                                                 
  6418. The CMS Gopher client retrieves documents from "gopher servers" and displays    
  6419. them on your screen.  Gopher servers run on a variety of hosts on InterNet,     
  6420. and the Gopher protocol allows them to interact with clients on any platform    
  6421. regardless of the operating system, local file conventions, or character set.   
  6422.                                                                                 
  6423. The format of the GOPHER command is:                                            
  6424. +---------------------------------------------------------------+               
  6425. |            |                                                  |               
  6426. |   GOPHER   |   [host   [port]]   [   (PATH    itempath        |               
  6427. |            |                     |   (BOOKMARK bookmark       |               
  6428. |            |                     |   (BOOKLIST                |               
  6429. |            |                                                  |               
  6430. |            |                         (TUBE    vaddr   ]       |               
  6431. |            |                                                  |               
  6432. +---------------------------------------------------------------+               
  6433.                                                                                 
  6434. Gopher is something that you "get into".  That means that command line          
  6435. options and parameters only affect start-up.  Once you are in Gopher,  the      
  6436. session is controlled using program function keys,  not with commands.          
  6437.                                                                                 
  6438. Function Keys:                                                                  
  6439.                                                                                 
  6440.         The function keys are usually set to:                                   
  6441.                                                                                 
  6442.                 PF1         HELP                                                
  6443.                 PF3         go back to the previous screen                      
  6444.                 PF6         find a string in the current file or menu           
  6445.                 PF7         scroll backward                                     
  6446.                 PF8         scroll forward                                      
  6447.                 PF9         set or delete a bookmark                            
  6448.                 PF10        list bookmarks                                      
  6449.                 PF11        view the selected file or menu                      
  6450.                 PF12        quit and return to CMS                              
  6451.                                                                                 
  6452. Options:                                                                        
  6453.                                                                                 
  6454.         (PATH       path        tells Gopher to read its start-up menu          
  6455.                                 from a particular directory path                
  6456.                                                                                 
  6457.         (BOOKMARK   bookmark    resumes viewing from the specified bookmark     
  6458.                                                                                 
  6459.         (BOOKLIST               provides a list of all of your bookmarks        
  6460.                                                                                 
  6461.         the above options are mutually exclusive                                
  6462.                                                                                 
  6463.         (TUBE       vaddr       indicates that terminal I/O should              
  6464.                                 be directed to the virtual address,             
  6465.                                 rather than to the CMS console                  
  6466.                                                                                 
  6467. GlobalVs:                                                                       
  6468.                                                                                 
  6469. Gopher honors the following user settable GLOBALVs (CMS Global Variables):      
  6470.                                                                                 
  6471.         HOST                                                                    
  6472.         PORT                                                                    
  6473.         PATH                                                                    
  6474.         NAME                                                                    
  6475.         TELNET                                                                  
  6476.         TN3270                                                                  
  6477.         VIEWER                                                                  
  6478.                                                                                 
  6479. These are all in GLOBALV group GOPHER.   To set,  say,  the default gopher      
  6480. server host,  issue the command:                                                
  6481.                                                                                 
  6482.         GLOBALV SELECT GOPHER SETP HOST host.domain                             
  6483.                                                                                 
  6484. where  host.domain  is the domain-style name for the gopher server host.        
  6485.                                                                                 
  6486. :READ  BROWSER  HELPGOPH A1 TMP200 01/13/93 14:01:27                            
  6487. .cm This CMS HELP file created by hand - RMT                                    
  6488. .cm                                                                             
  6489.                                                                                 
  6490. CMS Gopher - Viewing Directories                                                
  6491.                                                                                 
  6492. You are presented with a menu of items.  These may be files, directories        
  6493. of files, links to other Gopher servers, or other special functions.            
  6494. To "open" an item, place your cursor on or under the item then press <ENTER>.   
  6495.                                                                                 
  6496. Before each item is symbolic text explaining what type of item it is:           
  6497.                                                                                 
  6498.         <document>  (nothing), this item is a plain-text file                   
  6499.         <menu>      this item leads to another directory or Gopher              
  6500.         <phonebk>   this item leads to a CSO/qi Phonebook search                
  6501.         <search>    this item leads to a keyword search                         
  6502.         <telnet>    this item represents a telnet session                       
  6503. .cm     <)          "sound" (looks like a speaker), not supported on CMS        
  6504. .cm     <O>         PostScript (looks like an eye), not supported on CMS        
  6505.         <picture>   this item is a graphic                                      
  6506.                     (requires a grphics terminal to view)                       
  6507.         <binary>    this item is a "binary" file                                
  6508.                     (not interesting to view,  but downloadable)                
  6509.                                                                                 
  6510. Function keys active are:                                                       
  6511.                                                                                 
  6512.         ENTER       select an item                                              
  6513.         PF1         help (gives you this screen)                                
  6514. .cm     PF2         select an item (same as ENTER)                              
  6515.         PF3         go back to previous menu (if any)                           
  6516.         PF6         find particular string within the menu                      
  6517.         PF7         Scroll UP in the menu                                       
  6518.         PF8         Scroll DOWN in the menu                                     
  6519.         PF9         set a BOOKMARK on this panel                                
  6520.                     (or delete the BOOKMARK at the cursor                       
  6521.                     if you're viewing your bookmark list)                       
  6522.         PF10        go to the BOOKMARK list/select panel                        
  6523. .cm     PF11        display host/port/path to selected item                     
  6524.         PF12        quit entirely                                               
  6525.                                                                                 
  6526. :READ  VIEWER   HELPGOPH A1 TMP200 01/12/93 19:25:11                            
  6527. .cm This CMS HELP file created by hand - RMT                                    
  6528. .cm                                                                             
  6529.                                                                                 
  6530. CMS Gopher - Viewing Files                                                      
  6531.                                                                                 
  6532. The item you selected is a plain text file.  You may browse this file,  use     
  6533. the CMS editor (XEDIT) to make changes and/or save it to disk,  or print it.    
  6534.                                                                                 
  6535. Function keys active are:                                                       
  6536.                                                                                 
  6537.         PF1         help (gives you this screen)                                
  6538. .cm     PF2         pass the file off to XEDIT                                  
  6539.         PF3         go back to the menu                                         
  6540.         PF4         print the file                                              
  6541.         PF6         find a particular string in this file                       
  6542.         PF7         Scroll UP in the file                                       
  6543.         PF8         Scroll DOWN in the file                                     
  6544.         PF9         set a BOOKMARK referencing this file                        
  6545.         PF10        go to the BOOKMARK list/select panel                        
  6546. .cm     PF11        display host/port/path to this file                         
  6547.         PF12        quit                                                        
  6548.                                                                                 
  6549. You can override the internal viewer by setting the Global Variable VIEWER.     
  6550. For example,  if you prefer to use the LEXX editor to view gopher files,        
  6551.                                                                                 
  6552.         GLOBALV SELECT GOPHER SETLP VIEWER LEXX                                 
  6553.                                                                                 
  6554.                 ... would cause LEXX to be used to display gopher files.        
  6555.                                                                                 
  6556. :READ  GOP000I  HELPMSG  A1 TMP200 01/25/93 01:24:55                            
  6557.                                                                                 
  6558. 000I      Rice CMS Gopher 2.4.0                                                 
  6559.                                                                                 
  6560. Explanation:    This is Rice University's CMS Gopher v2 r4.                     
  6561.                 Message number zero is merely program identification.           
  6562.                                                                                 
  6563. System Action:  none                                                            
  6564.                                                                                 
  6565. User Response:  none                                                            
  6566.                                                                                 
  6567. :READ  GOPGEN   HELPCMS  A1 TMP200 01/22/93 10:50:28                            
  6568. .cm                                                                             
  6569. .cm       Name: GOPGEN HELPCMS                                                  
  6570. .cm             help for GOPGEN EXEC                                            
  6571. .cm     Author: Rick Troth, Rice University, Information Systems                
  6572. .cm       Date: 1993-Jan-22                                                     
  6573. .cm                                                                             
  6574. .cm             Yes, this was created by hand.                                  
  6575. .cm                                                                             
  6576.                                                                                 
  6577.  GOPGEN EXEC                                                                    
  6578.                                                                                 
  6579.  Use GOPGEN to generate files used by the CMS Gopher client and server.         
  6580.  Use GOPGEN to create the INDEX file used by the server for keyword searches.   
  6581.  Use GOPGEN to rebuild the message repository for your local language.          
  6582.                                                                                 
  6583.  +--------------+-----------------------------------------------------+         
  6584.  |              |                                                     |         
  6585.  |   GOPGEN     |   INDEX      menu                                   |         
  6586.  |              |                                                     |         
  6587.  |              |   MESSAGES   [language]                             |         
  6588.  |              |   MSGS                                              |         
  6589.  |              |                                                     |         
  6590.  |              |   program                                           |         
  6591.  |              |                                                     |         
  6592.  +--------------+-----------------------------------------------------+         
  6593.                                                                                 
  6594. ó|Operationsó%                                                                  
  6595.                                                                                 
  6596.  INDEX                                                                          
  6597.      uses WISHLG to generate a keyword index on the files in a menu.            
  6598.      The menu must be defined by a FILELIST or an SFS sub-directory.            
  6599.      You must place the indexfile,  menu GOPINDEX,  where the server            
  6600.      can access it,  either on the minidisk where the FILELIST resides          
  6601.      or in the SFS directory that was indexed.                                  
  6602.                                                                                 
  6603.  MESSAGES                                                                       
  6604.      for non-AMENG sites,  after translating the message repository             
  6605.      source into your local language,  rename the source accordingly.           
  6606.      GOPGEN will invoke GENMSG to create a message repository object file.      
  6607.                                                                                 
  6608.  program                                                                        
  6609.      after applying local modifications with XEDIT (CTL VMGOPHER,               
  6610.      GOPGEN runs EXECUPDT to create a new EXEC or REXX pipeline stage.          
  6611.      After testing to verify correct operation,  place this file on the         
  6612.      minidisk or in the SFS directory where the rest of CMS Gopher resides.     
  6613.                                                                                 
  6614. :READ  GOPHERDH REXX     A1 TMP200 06/25/92 13:22:17                            
  6615. /*                                                                              
  6616.  *        Name: GOPHERDH REXX                                                   
  6617.  *              pipeline stage for interpreting the CMS HELP database           
  6618.  *      Author: Rick Troth, Rice Univ, I/S VM Systems Support                   
  6619.  *        Date: 1992-Apr-25, Jun-24                                             
  6620.  *                                                                              
  6621.  *              This gem is supplied with Rice CMS GopherD.                     
  6622.  */                                                                             
  6623.                                                                                 
  6624. /*  accept a command line;  remember options  */                                
  6625. Parse Upper Arg item '(' opts                                                   
  6626.                                                                                 
  6627. /*  the "item" may have leading "path" parts,  which we just ignore   */        
  6628. Do While Index(item,'/') > 0; Parse Var item . '/' item; End                    
  6629.                                                                                 
  6630. /*  make it right  */                                                           
  6631. If Words(item) = 0 Then item = "TASK HELP"                                      
  6632. If Words(item) = 1 Then topic = "CMS"                                           
  6633.                    Else Parse Var item topic item .                             
  6634.                                                                                 
  6635. /*  is it a task? menu? or leaf item?  */                                       
  6636. If item = "TASK" Then Do; item = topic; topic = "TASK"; End                     
  6637. If item = "MENU" Then Do; item = topic; topic = "MENU"; End                     
  6638.                                                                                 
  6639. /*  call the right pipeline stages  */                                          
  6640. Select  /*  topic  */                                                           
  6641.                                                                                 
  6642.     When topic = "TASKTEXT" Then Call HELPTEXT                                  
  6643.     When topic = "MENUTEXT" Then Call HELPTEXT                                  
  6644.                                                                                 
  6645.     When topic = "TASK" Then Call HELPTASK                                      
  6646. /*      'CALLPIPE DISK' item 'HELPTASK * | HELPTASK' item '| *:'      */        
  6647.                                                                                 
  6648.     When topic = "MENU" Then CALL HELPMENU                                      
  6649. /*      'CALLPIPE DISK' item 'HELPMENU * | HELPMENU' item '| *:'      */        
  6650.                                                                                 
  6651.     Otherwise                CALL HELPITEM                                      
  6652. /*      'CALLPIPE COMMAND HELP' topic item '(NOSCREEN' opts '| *:'    */        
  6653.                                                                                 
  6654.     End  /*  Select  topic  */                                                  
  6655.                                                                                 
  6656. Exit                                                                            
  6657.                                                                                 
  6658.                                                                                 
  6659.                                                                                 
  6660. /* ------------------------------------------------------------ HELPITEM        
  6661.  */                                                                             
  6662. HELPITEM:                                                                       
  6663.                                                                                 
  6664. 'CALLPIPE COMMAND HELP' topic item '(NOSCREEN' opts '| *:'                      
  6665.                                                                                 
  6666. Return                                                                          
  6667.                                                                                 
  6668.                                                                                 
  6669.                                                                                 
  6670. /* ------------------------------------------------------------ HELPTEXT        
  6671.  */                                                                             
  6672. HELPTEXT:                                                                       
  6673.                                                                                 
  6674. /*  it would be way-cool if we could present the preliminary text     *         
  6675.  *  ("user instructions",  or whatever you want to call it)           *         
  6676.  *  as a plain-text item from the menu we're creating here.           */        
  6677.                                                                                 
  6678. If topic = "MENUTEXT" Then 'ADDPIPE DISK' item 'HELPMENU * | *.INPUT:'          
  6679.                       Else 'ADDPIPE DISK' item 'HELPTASK * | *.INPUT:'          
  6680.                                                                                 
  6681. /* read and replay displayed text or "user instructions" from task */           
  6682. 'PEEKTO LINE'                                                                   
  6683. Do While rc = 0                                                                 
  6684.     If Strip(line) = "" & Strip(prev) = "" Then Leave                           
  6685.                                                                                 
  6686.     If Left(line,1) ^= '.' Then Do                                              
  6687.         /* remove any HELP control sequences */                                 
  6688.         p = Index(line,'4A'x)                                                   
  6689.         Do While p > 0                                                          
  6690.             line = Left(line,p-1) || Substr(line,p+2)                           
  6691.             p = Index(line,'4A'x)                                               
  6692.             End                                                                 
  6693.         /* and send this line of text down the pipe */                          
  6694.         'OUTPUT' line                                                           
  6695.         End                                                                     
  6696.                                                                                 
  6697.     prev = line                                                                 
  6698.     'READTO'                                                                    
  6699.     'PEEKTO LINE'                                                               
  6700.     End  /*  Do  While  */                                                      
  6701.                                                                                 
  6702. Return                                                                          
  6703.                                                                                 
  6704.                                                                                 
  6705.                                                                                 
  6706. /* ------------------------------------------------------------ HELPTASK        
  6707.  */                                                                             
  6708. HELPTASK:                                                                       
  6709.                                                                                 
  6710. 'ADDPIPE DISK' item 'HELPTASK * | *.INPUT:'                                     
  6711.                                                                                 
  6712. /* first consume the displayed text or "user instructions" */                   
  6713. 'PEEKTO LINE'                                                                   
  6714. Do While rc = 0                                                                 
  6715.     If Strip(line) = "" & Strip(prev) = "" Then Leave                           
  6716. /*  If Left(line,1) ^= '.' Then 'OUTPUT' line  */                               
  6717.     prev = line                                                                 
  6718.     'READTO'                                                                    
  6719.     'PEEKTO LINE'                                                               
  6720.     End  /*  Do  While  */                                                      
  6721.                                                                                 
  6722. 'OUTPUT' "0" || item "task heading text" || '05'x || ,                          
  6723.          "0" || "TASKTEXT" item                                                 
  6724.                                                                                 
  6725. /* now interpret the task lines and make a menu */                              
  6726. 'PEEKTO LINE'                                                                   
  6727. Do While rc = 0                                                                 
  6728.     If Left(line,1) ^= '.' & Strip(line) ^= "" Then Do                          
  6729.         /* ignoring blank lines and control lines */                            
  6730.         Parse Var line 1 path 25 title                                          
  6731.                                                                                 
  6732.         /* remove HELP control sequences from titles */                         
  6733.         p = Index(title,'4A'x)                                                  
  6734.         Do While p > 0                                                          
  6735.             title = Left(title,p-1) || Substr(title,p+2)                        
  6736.             p = Index(title,'4A'x)                                              
  6737.             End                                                                 
  6738.                                                                                 
  6739.         type = "0"                                                              
  6740.         Parse Upper Var path topic item .                                       
  6741.         If item = "TASK" Then Do; item = topic; topic = "TASK"; End             
  6742.         If item = "MENU" Then Do; item = topic; topic = "MENU"; End             
  6743.         If topic = "TASK" | topic = "MENU" Then type = "1"                      
  6744.         'OUTPUT' type || title || '05'x || type || topic item                   
  6745. /*      'OUTPUT' type || title || '05'x || type || path               */        
  6746.         End  /*  If  ..  Do  */                                                 
  6747.                                                                                 
  6748.     'READTO'                                                                    
  6749.     'PEEKTO LINE'                                                               
  6750.     End  /*  Do  While  */                                                      
  6751.                                                                                 
  6752. Return                                                                          
  6753.                                                                                 
  6754.                                                                                 
  6755.                                                                                 
  6756. /* ------------------------------------------------------------ HELPMENU        
  6757.  */                                                                             
  6758. HELPMENU:                                                                       
  6759.                                                                                 
  6760. 'ADDPIPE DISK' item 'HELPMENU * | *.INPUT:'                                     
  6761.                                                                                 
  6762. topic = item                                                                    
  6763.                                                                                 
  6764. 'PEEKTO LINE'                                                                   
  6765. Do While rc = 0                                                                 
  6766.     If Strip(line) = "" & Strip(prev) = "" Then Leave                           
  6767.     prev = line                                                                 
  6768.     'READTO'                                                                    
  6769.     'PEEKTO LINE'                                                               
  6770.     End  /*  Do  While  */                                                      
  6771.                                                                                 
  6772. 'OUTPUT' "0" || item "menu heading text" || '05'x || ,                          
  6773.          "0" || "MENUTEXT" item                                                 
  6774.                                                                                 
  6775. 'PEEKTO LINE'                                                                   
  6776. Do While rc = 0                                                                 
  6777.     If Left(line,1) ^= '.' & Strip(line) ^= "" Then Do                          
  6778.         Parse Var line item .                                                   
  6779.         key = Left(item,1)                                                      
  6780.         Select  /*  key  */                                                     
  6781.             When key = '*' Then                                                 
  6782.                 'OUTPUT' "1" || line || '05'x ||  ,                             
  6783.                     "1" || "MENU" Substr(item,2)                                
  6784.             When key = ':' Then                                                 
  6785.                 'OUTPUT' "1" || line || '05'x || ,                              
  6786.                     "1" || "TASK" Substr(item,2)                                
  6787.             Otherwise                                                           
  6788.                 'OUTPUT' "0" || line || '05'x || ,                              
  6789.                     "0" || topic item                                           
  6790.             End  /*  Select  key  */                                            
  6791.         End  /*  If  ..  Do  */                                                 
  6792.     'READTO'                                                                    
  6793.     'PEEKTO LINE'                                                               
  6794.     End  /*  Do  While  */                                                      
  6795.                                                                                 
  6796. Return                                                                          
  6797.                                                                                 
  6798. :READ  GOPHERDI REXX     A1 TMP200 01/18/93 18:52:10                            
  6799. /*                                                                              
  6800.  *        Name: GOPHERDH REXX (GOPHERDI)                                        
  6801.  *              pipeline stage for interpreting the CMS HELP database           
  6802.  *      Author: Rick Troth, Rice University, Information Systems                
  6803.  *        Date: 1992-Apr-25, Jun-24, Jul-29, 1993-Jan-18                        
  6804.  *                                                                              
  6805.  *              This gem is supplied with the Rice CMS Gopher server.           
  6806.  *              Feel free to use it as an example of building                   
  6807.  *              your own Gopher server smart pipeline stages.                   
  6808.  */                                                                             
  6809.                                                                                 
  6810. Parse Source . . . . . arg0 .                                                   
  6811. argo = arg0 || ':'                                                              
  6812. Parse Arg args                                                                  
  6813. Say argo args                                                                   
  6814.                                                                                 
  6815. /*  accept a command line;  remember options  */                                
  6816. Parse Upper Arg item '(' opts ')' .                                             
  6817.                                                                                 
  6818. /*  the "item" may have leading "path" parts,  which we just ignore   */        
  6819. Do While Index(item,'/') > 0; Parse Var item . '/' item; End                    
  6820.                                                                                 
  6821. /*  make it right  */                                                           
  6822. If Words(item) = 0 Then item = "TASK HELP"                                      
  6823. If Words(item) = 1 Then topic = "CMS"                                           
  6824.                    Else Parse Var item topic item .                             
  6825.                                                                                 
  6826. /*  is it a task? menu? or leaf item?  */                                       
  6827. If item = "TASK" Then Do; item = topic; topic = "TASK"; End                     
  6828. If item = "MENU" Then Do; item = topic; topic = "MENU"; End                     
  6829.                                                                                 
  6830. /*  call the right pipeline stages  */                                          
  6831. Select  /*  topic  */                                                           
  6832.                                                                                 
  6833.     When topic = "TASKTEXT" Then Call HELPTEXT                                  
  6834.     When topic = "MENUTEXT" Then Call HELPTEXT                                  
  6835.                                                                                 
  6836.     When topic = "TASK"     Then Call HELPTASK                                  
  6837.                                                                                 
  6838.     When topic = "MENU"     Then CALL HELPMENU                                  
  6839.                                                                                 
  6840.     Otherwise                    CALL HELPITEM                                  
  6841.                                                                                 
  6842.     End  /*  Select  topic  */                                                  
  6843.                                                                                 
  6844. Exit rc                                                                         
  6845.                                                                                 
  6846.                                                                                 
  6847.                                                                                 
  6848. /* ------------------------------------------------------------ HELPITEM        
  6849.  *  Neither a TASK nor a MENU node;  this is a leaf.                            
  6850.  */                                                                             
  6851. HELPITEM:                                                                       
  6852.                                                                                 
  6853. 'CALLPIPE COMMAND HELP' topic item '(NOSCREEN' opts '| *:'                      
  6854.                                                                                 
  6855. Return                                                                          
  6856.                                                                                 
  6857.                                                                                 
  6858.                                                                                 
  6859. /* ------------------------------------------------------------ HELPTEXT        
  6860.  *  This section is a left-over from the pre-Panda version.                     
  6861.  *  It is still called if you invoke the older HELPTASK or HELPMENU.            
  6862.  */                                                                             
  6863. HELPTEXT:                                                                       
  6864.                                                                                 
  6865. /*  it would be way-cool if we could present the preliminary text     *         
  6866.  *  ("user instructions",  or whatever you want to call it)           *         
  6867.  *  as a plain-text item from the menu we're creating here.           */        
  6868.                                                                                 
  6869. If topic = "MENUTEXT" Then 'ADDPIPE <' item 'HELPMENU * | *.INPUT:'             
  6870.                       Else 'ADDPIPE <' item 'HELPTASK * | *.INPUT:'             
  6871. If rc ^= 0 Then Return                                                          
  6872.                                                                                 
  6873. /* read and replay displayed text or "user instructions" from task */           
  6874. Do Forever                                                                      
  6875.                                                                                 
  6876.     'PEEKTO LINE'                                                               
  6877.     If rc ^= 0 Then Leave                                                       
  6878.                                                                                 
  6879.     If Strip(line) = "" & Strip(prev) = "" Then Leave                           
  6880.                                                                                 
  6881.     If Left(line,1) ^= '.' Then Do                                              
  6882.         /* remove any HELP control sequences */                                 
  6883.         p = Index(line,'4A'x)                                                   
  6884.         Do While p > 0                                                          
  6885.             line = Left(line,p-1) || Substr(line,p+2)                           
  6886.             p = Index(line,'4A'x)                                               
  6887.             End                                                                 
  6888.         /* and send this line of text down the pipe */                          
  6889.         'OUTPUT' line                                                           
  6890.         If rc ^= 0 Then Leave                                                   
  6891.         End                                                                     
  6892.                                                                                 
  6893.     prev = line                                                                 
  6894.     'READTO'                                                                    
  6895.     If rc ^= 0 Then Leave                                                       
  6896.                                                                                 
  6897.     End  /*  Do  Forever  */                                                    
  6898.                                                                                 
  6899. Return                                                                          
  6900.                                                                                 
  6901.                                                                                 
  6902.                                                                                 
  6903. /* ------------------------------------------------------------ HELPTASK        
  6904.  *  Selected item is a TASK.   Presume we have GOPSRVMB following.              
  6905.  */                                                                             
  6906. HELPTASK:                                                                       
  6907.                                                                                 
  6908. 'ADDPIPE <' item 'HELPTASK * | *.INPUT:'                                        
  6909. If rc ^= 0 Then Return                                                          
  6910.                                                                                 
  6911. /* first show the displayed text or user instructions as "info" */              
  6912. Do Forever                                                                      
  6913.                                                                                 
  6914.     'PEEKTO LINE'                                                               
  6915.     If rc ^= 0 Then Leave                                                       
  6916.                                                                                 
  6917.     If Strip(line) = "" & Strip(prev) = "" Then Leave                           
  6918.     If Left(line,1) ^= '.' Then 'OUTPUT' 'i' || line                            
  6919.     If rc ^= 0 Then Leave                                                       
  6920.     prev = line                                                                 
  6921.                                                                                 
  6922.     'READTO'                                                                    
  6923.     If rc ^= 0 Then Leave                                                       
  6924.                                                                                 
  6925.     End  /*  Do  Forever  */                                                    
  6926.                                                                                 
  6927. /* now interpret the task lines and make a menu */                              
  6928. Do Forever                                                                      
  6929.                                                                                 
  6930.     'PEEKTO LINE'                                                               
  6931.     If rc ^= 0 Then Leave                                                       
  6932.                                                                                 
  6933.     If Left(line,1) ^= '.' & Strip(line) ^= "" Then Do                          
  6934.         /* ignoring blank lines and control lines */                            
  6935.         Parse Var line 1 path 25 title                                          
  6936.                                                                                 
  6937.         /* remove HELP control sequences from titles */                         
  6938.         p = Index(title,'4A'x)                                                  
  6939.         Do While p > 0                                                          
  6940.             title = Left(title,p-1) || Substr(title,p+2)                        
  6941.             p = Index(title,'4A'x)                                              
  6942.             End                                                                 
  6943.                                                                                 
  6944.         type = "0"                                                              
  6945.         Parse Upper Var path topic item . '(' . ')' .                           
  6946.         If item = "TASK" Then Do; item = topic; topic = "TASK"; End             
  6947.         If item = "MENU" Then Do; item = topic; topic = "MENU"; End             
  6948.         If topic = "TASK" | topic = "MENU" Then type = "1"                      
  6949.         'OUTPUT' type || title || '05'x || type || topic item                   
  6950. /*      'OUTPUT' type || title || '05'x || type || path               */        
  6951.         If rc ^= 0 Then Leave                                                   
  6952.         End  /*  If  ..  Do  */                                                 
  6953.                                                                                 
  6954.     'READTO'                                                                    
  6955.     If rc ^= 0 Then Leave                                                       
  6956.                                                                                 
  6957.     End  /*  Do  Forever  */                                                    
  6958.                                                                                 
  6959. Return                                                                          
  6960.                                                                                 
  6961.                                                                                 
  6962.                                                                                 
  6963. /* ------------------------------------------------------------ HELPMENU        
  6964.  *  Selected item is a MENU.   Presume we have GOPSRVMB follows.                
  6965.  */                                                                             
  6966. HELPMENU:                                                                       
  6967.                                                                                 
  6968. 'ADDPIPE <' item 'HELPMENU * | *.INPUT:'                                        
  6969. If rc ^= 0 Then Return                                                          
  6970.                                                                                 
  6971. topic = item                                                                    
  6972.                                                                                 
  6973. /* first show the displayed text or user instructions as "info" */              
  6974. Do Forever                                                                      
  6975.                                                                                 
  6976.     'PEEKTO LINE'                                                               
  6977.     If rc ^= 0 Then Leave                                                       
  6978.                                                                                 
  6979.     /* Menu type */                                                             
  6980.     if left(line,3) = '.mt' then parse var line . topic .                       
  6981.                                                                                 
  6982.     If Strip(line) = "" & Strip(prev) = "" Then Leave                           
  6983.     If Left(line,1) ^= '.' Then 'OUTPUT' 'i' || line                            
  6984.     If rc ^= 0 Then Leave                                                       
  6985.     prev = line                                                                 
  6986.                                                                                 
  6987.     'READTO'                                                                    
  6988.     If rc ^= 0 Then Leave                                                       
  6989.                                                                                 
  6990.     End  /*  Do  While  */                                                      
  6991.                                                                                 
  6992. Do Forever                                                                      
  6993.                                                                                 
  6994.     'PEEKTO LINE'                                                               
  6995.     If rc ^= 0 Then Leave                                                       
  6996.                                                                                 
  6997.     /* Menu type */                                                             
  6998.     if left(line,3) = '.mt' then parse var line . topic .                       
  6999.                                                                                 
  7000.     If Left(line,1) ^= '.' & Strip(line) ^= "" Then Do                          
  7001.         Parse Var line item .                                                   
  7002.         key = Left(item,1)                                                      
  7003.         Select  /*  key  */                                                     
  7004.             When key = '*' Then                                                 
  7005.                 'OUTPUT' "1" || line || '05'x ||  ,                             
  7006.                     "1" || "MENU" Substr(item,2)                                
  7007.             When key = ':' Then                                                 
  7008.                 'OUTPUT' "1" || line || '05'x || ,                              
  7009.                     "1" || "TASK" Substr(item,2)                                
  7010.             Otherwise                                                           
  7011.                 'OUTPUT' "0" || line || '05'x || ,                              
  7012.                     "0" || topic item                                           
  7013.             End  /*  Select  key  */                                            
  7014.         If rc ^= 0 Then Leave                                                   
  7015.         End  /*  If  ..  Do  */                                                 
  7016.                                                                                 
  7017.     'READTO'                                                                    
  7018.     If rc ^= 0 Then Leave                                                       
  7019.                                                                                 
  7020.     End  /*  Do  While  */                                                      
  7021.                                                                                 
  7022. Return                                                                          
  7023.                                                                                 
  7024.                                                                                 
  7025.                                                                                 
  7026. /*  The following two routines are useful if you serve    *                     
  7027.  *  clients that can't handle the Panda "info" type       */                    
  7028.                                                                                 
  7029.                                                                                 
  7030.                                                                                 
  7031. /* ------------------------------------------------------------ HELPTASK        
  7032.  */                                                                             
  7033. HELPTASK:                                                                       
  7034.                                                                                 
  7035. 'ADDPIPE DISK' item 'HELPTASK * | *.INPUT:'                                     
  7036.                                                                                 
  7037. /* first consume the displayed text or "user instructions" */                   
  7038. 'PEEKTO LINE'                                                                   
  7039. Do While rc = 0                                                                 
  7040.     If Strip(line) = "" & Strip(prev) = "" Then Leave                           
  7041.     prev = line                                                                 
  7042.     'READTO'                                                                    
  7043.     'PEEKTO LINE'                                                               
  7044.     End  /*  Do  While  */                                                      
  7045.                                                                                 
  7046. 'OUTPUT' "0" || item "task heading text" || '05'x || ,                          
  7047.          "0" || "TASKTEXT" item                                                 
  7048.                                                                                 
  7049. /* now interpret the task lines and make a menu */                              
  7050. 'PEEKTO LINE'                                                                   
  7051. Do While rc = 0                                                                 
  7052.     If Left(line,1) ^= '.' & Strip(line) ^= "" Then Do                          
  7053.         /* ignoring blank lines and control lines */                            
  7054.         Parse Var line 1 path 25 title                                          
  7055.                                                                                 
  7056.         /* remove HELP control sequences from titles */                         
  7057.         p = Index(title,'4A'x)                                                  
  7058.         Do While p > 0                                                          
  7059.             title = Left(title,p-1) || Substr(title,p+2)                        
  7060.             p = Index(title,'4A'x)                                              
  7061.             End                                                                 
  7062.                                                                                 
  7063.         type = "0"                                                              
  7064.         Parse Upper Var path topic item .                                       
  7065.         If item = "TASK" Then Do; item = topic; topic = "TASK"; End             
  7066.         If item = "MENU" Then Do; item = topic; topic = "MENU"; End             
  7067.         If topic = "TASK" | topic = "MENU" Then type = "1"                      
  7068.         'OUTPUT' type || title || '05'x || type || topic item                   
  7069. /*      'OUTPUT' type || title || '05'x || type || path               */        
  7070.         End  /*  If  ..  Do  */                                                 
  7071.                                                                                 
  7072.     'READTO'                                                                    
  7073.     'PEEKTO LINE'                                                               
  7074.     End  /*  Do  While  */                                                      
  7075.                                                                                 
  7076. Return                                                                          
  7077.                                                                                 
  7078.                                                                                 
  7079.                                                                                 
  7080. /* ------------------------------------------------------------ HELPMENU        
  7081.  */                                                                             
  7082. HELPMENU:                                                                       
  7083.                                                                                 
  7084. 'ADDPIPE DISK' item 'HELPMENU * | *.INPUT:'                                     
  7085.                                                                                 
  7086. topic = item                                                                    
  7087.                                                                                 
  7088. /* first consume the displayed text or "user instructions" */                   
  7089. 'PEEKTO LINE'                                                                   
  7090. Do While rc = 0                                                                 
  7091.     If Strip(line) = "" & Strip(prev) = "" Then Leave                           
  7092.     prev = line                                                                 
  7093.     'READTO'                                                                    
  7094.     'PEEKTO LINE'                                                               
  7095.     End  /*  Do  While  */                                                      
  7096.                                                                                 
  7097. 'OUTPUT' "0" || item "menu heading text" || '05'x || ,                          
  7098.          "0" || "MENUTEXT" item                                                 
  7099.                                                                                 
  7100. 'PEEKTO LINE'                                                                   
  7101. Do While rc = 0                                                                 
  7102.     If Left(line,1) ^= '.' & Strip(line) ^= "" Then Do                          
  7103.         Parse Var line item .                                                   
  7104.         key = Left(item,1)                                                      
  7105.         Select  /*  key  */                                                     
  7106.             When key = '*' Then                                                 
  7107.                 'OUTPUT' "1" || line || '05'x ||  ,                             
  7108.                     "1" || "MENU" Substr(item,2)                                
  7109.             When key = ':' Then                                                 
  7110.                 'OUTPUT' "1" || line || '05'x || ,                              
  7111.                     "1" || "TASK" Substr(item,2)                                
  7112.             Otherwise                                                           
  7113.                 'OUTPUT' "0" || line || '05'x || ,                              
  7114.                     "0" || topic item                                           
  7115.             End  /*  Select  key  */                                            
  7116.         End  /*  If  ..  Do  */                                                 
  7117.     'READTO'                                                                    
  7118.     'PEEKTO LINE'                                                               
  7119.     End  /*  Do  While  */                                                      
  7120.                                                                                 
  7121. Return                                                                          
  7122.                                                                                 
  7123. :READ  HELP     NAMES    A1 TMP200 10/20/92 20:02:39                            
  7124. *                                                                               
  7125. *         Name: HELP NAMES                                                      
  7126. *               an example of how to automate menu building                     
  7127. *               and file construction/presentation with CMS GopherD             
  7128. *       Author: Rick Troth, Rice University, I/S VM Systems Support             
  7129. *         Date: 1992-Apr-25, Jun-24, Jul-31                                     
  7130. *                                                                               
  7131. *               This file is supplied with the Rice CMS Gopher server.          
  7132. *                                                                               
  7133. *         Note: there is no HELP FILELIST to go along with this                 
  7134. *               NAMES file.   When the parent FILELIST references               
  7135. *               HELP FILELIST,  and it doesn't exist,  the entry for            
  7136. *               :nick..  (relative path ".")  in this is used.                  
  7137. *                                                                               
  7138. *         Note: the tags :fn. and :ft. are not used in this example             
  7139. *                                                                               
  7140. *         NOTE! you MUST change the :auth. to match your local subnet           
  7141. *               (I don't feel good gophering-out IBM documents to               
  7142. *               the whole world,  and this is the *same* HELP NAMES             
  7143. *               file that we use at Rice)                                       
  7144. *                                                                               
  7145.                                                                                 
  7146. *                                                                               
  7147. * default pipe specification for any path                                       
  7148. :nick.*     :pipe.GOPHERDH &0 (ALL                                              
  7149.                                                                                 
  7150. *                                                                               
  7151. * pipe specification for this menu itself                                       
  7152. :nick..     :pipe.GOPHERDH                                                      
  7153. *                                                                               
  7154. :READ  NEWS     NAMES    A1 TMP200 07/31/92 08:35:58                            
  7155. *                                                                               
  7156. *         Name: NEWS NAMES                                                      
  7157. *               (see HELP NAMES for a description)                              
  7158. *       Author: Rick Troth, Rice University, I/S VM Systems Support             
  7159. *         Date: 1992-Jun-25, Jul-31                                             
  7160. *                                                                               
  7161.                                                                                 
  7162. *                                                                               
  7163. * default pipe specification for any path                                       
  7164. :nick.*     :pipe.GOPHERDH &0 (ALL      :auth.128.42.0.0                        
  7165.                                                                                 
  7166. *                                                                               
  7167. * pipe specification for this menu itself                                       
  7168. :nick..     :pipe.GOPHERDH TASK NEWS    :auth.128.42.0.0                        
  7169. *                                                                               
  7170. :READ  GOPHER   COPYRIGH A1 TMP200 01/22/93 18:30:37                            
  7171. /*                                                                              
  7172.  *      Copyright 1992, 93 Richard M. Troth.   This software was developed      
  7173.  *      with resources provided by Rice University and is intended to           
  7174.  *      serve Rice's user community.   Rice has benefitted greatly from         
  7175.  *      the free distribution of software,  therefore distribution of           
  7176.  *      unmodified copies of this material is not restricted.   You may         
  7177.  *      change your own copy as needed.   Neither Rice University nor           
  7178.  *      any of its employees or students shall be held liable for damages       
  7179.  *      resulting from the use of this software.                                
  7180.  */                                                                             
  7181. :READ  GOPCLI   $EXEC    A1 TMP200 01/25/93 15:25:48                            
  7182. /*                                                                      00010000
  7183.  *        Name: GOPCLI EXEC                                             00020000
  7184.  *              VM TCP/IP Network GOPHER Client                         00030000
  7185.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  7186.  *              Major thanks to Arty Ecock for the wonderful RXSOCKET.  00050000
  7187.  *              Thanks to Serge Goldstein for help with many things.    00060000
  7188.  *        Date: 1992-Dec-23                                             00070000
  7189.  */                                                                     00080000
  7190.                                                                         00090000
  7191. /*                                                                      00100000
  7192.  *      Copyright 1992 Richard M. Troth.   This software was developed  00110000
  7193.  *      with resources provided by Rice University and is intended      00120000
  7194.  *      to serve Rice's user community.   Rice has benefitted greatly   00130000
  7195.  *      from the free distribution of software,  therefore distribution 00140000
  7196.  *      of unmodified copies of this material is not restricted.        00150000
  7197.  *      You may change your own copy as needed.   Neither Rice          00160000
  7198.  *      University nor any of its employees or students shall be held   00170000
  7199.  *      liable for damages resulting from the use of this software.     00180000
  7200.  */                                                                     00190000
  7201.                                                                         00200000
  7202. /*                                                                      00210000
  7203.  *       Calls:                                                         00220000
  7204.  *              RXSOCKET MODULE   -- for TCP/IP network services        00230000
  7205.  *              PIPE     MODULE   -- for various I/O functions          00240000
  7206.  *              GLOBALV           -- for temp and perm global vars      00250000
  7207.  *              XMITMSG           -- for all message output             00260000
  7208.  *              VM TCP/IP, V2 or later (through RXSOCKET)               00270000
  7209.  *                                                                      00280000
  7210.  *              GOPCLINI EXEC     -- to initialize many things          00290000
  7211.  *              GOPCLITM REXX     -- to fetch the first item (a menu)   00300000
  7212.  *              GOPCLIMB REXX     -- to display a menu (from bookmarks) 00310000
  7213.  *                     both of which call other gems                    00320000
  7214.  *                                                                      00330000
  7215.  *    perm GVs:                                                         00340000
  7216.  *        HOST  -  the host to connect to for the root menu             00350000
  7217.  *        PORT  -  the port on that host for Gopher service             00360000
  7218.  *        PATH  -  the path to the initial menu                         00370000
  7219.  *        NAME  -  the name of the initial menu                         00380000
  7220.  *      TELNET  -  the name of the CMS TELNET command  (user preference)00390000
  7221.  *      TN3270  -  the name of the command for 3270 telnet connections  00400000
  7222.  *      VIEWER  -  the CMS command (XEDIT or BROWSE) used to view a file00410000
  7223.  *   BOOKMARK.  -  prefix for all bookmark variables,  where what       00420000
  7224.  *                 follows the dot is the name of the bookmark          00430000
  7225.  *                                                                      00440000
  7226.  *    temp GVs:                                                         00450000
  7227.  *        TUBE  -  the virtual address of a DIALed terminal (not cons)  00460000
  7228.  *      GOPHER  -  the IUCV path name and translate table name          00470000
  7229.  *      PROGID  -  program name                                         00480000
  7230.  *        ITEM  -  a line of "gopher menu data" for the chosen item     00490000
  7231.  *         ...                                                          00500000
  7232.  */                                                                     00510000
  7233.                                                                         00520000
  7234. Trace "OFF"                                                             00530000
  7235.                                                                         00540000
  7236. Address "COMMAND"                                                       00550000
  7237.                                                                         00560000
  7238. 'SET LANGUAGE (ADD GOP USER'                                            00570000
  7239. If rc ^= 0 Then Exit rc                                                 00580000
  7240.                                                                         00590000
  7241. 'STATE PIPE MODULE *'                                                   00600000
  7242. If rc ^= 0 Then Do                                                      00610000
  7243.     qrc = rc                                                            00620000
  7244.     /*  "You must have CMS Pipelines to run CMS Gopher."  */            00630000
  7245.     'XMITMSG 3 (APPLID GOP CALLER CLI ERRMSG'                           00640000
  7246.     Exit qrc                                                            00650000
  7247.     End  /*  If  ..  Do  */                                             00660000
  7248.                                                                         00670000
  7249. /*  Thanks to Nick LaFlamme for the linemode catcher.  */               00680000
  7250. 'PIPE COMMAND QUERY DISPLAY'                                            00690000
  7251. If rc ^= 0 Then Do                                                      00700000
  7252.     qrc = rc                                                            00710000
  7253.     'XMITMSG 523 (ERRMSG'       /*  "Typewriter mode"  */               00720000
  7254.     /*  "CMS Gopher requires a full-screen terminal."  */               00730000
  7255.     'XMITMSG 926 (APPLID GOP CALLER CLI ERRMSG'                         00740000
  7256.     Exit qrc                                                            00750000
  7257.     End  /*  If  ..  Do  */                                             00760000
  7258.                                                                         00770000
  7259. 'STATE RXSOCKET MODULE *'                                               00780000
  7260. If rc ^= 0 Then Do                                                      00790000
  7261.     qrc = rc                                                            00800000
  7262.     /*  "You must have RXSOCKET to run CMS Gopher."  */                 00810000
  7263.     'XMITMSG 1 (APPLID GOP CALLER CLI ERRMSG'                           00820000
  7264.     Exit qrc                                                            00830000
  7265.     End  /*  If  ..  Do  */                                             00840000
  7266.                                                                         00850000
  7267. 'STATE TCPIP DATA *'                                                    00860000
  7268. If rc ^= 0 Then Do                                                      00870000
  7269.     qrc = rc                                                            00880000
  7270.     /*  "You must have VM TCP/IP V2 to run CMS Gopher."  */             00890000
  7271.     'XMITMSG 2 (APPLID GOP CALLER CLI ERRMSG'                           00900000
  7272.     Exit qrc                                                            00910000
  7273.     End  /*  If  ..  Do  */                                             00920000
  7274.                                                                         00930000
  7275. Parse Arg host port path '(' options ')' .                              00940000
  7276.                                                                         00950000
  7277. If host = "" & options = "" Then 'GLOBALV SELECT GOPHER GET PATH NAME'  00960000
  7278.                             Else name = ""                              00970000
  7279.                                                                         00980000
  7280. /* Initialize some variables */                                         00990000
  7281. bookmark = ""                                                           01000000
  7282. bkl  = 0                                                                01010000
  7283. tube = "CONS"                                                           01020000
  7284. quit = 0                                                                01030000
  7285.                                                                         01040000
  7286. /* process options, if any */                                           01050000
  7287. Do While options ^= ""                                                  01060000
  7288.     Parse Var options op options                                        01070000
  7289.     Upper op                                                            01080000
  7290.     Select  /*  op  */                                                  01090000
  7291.         When    Abbrev("TOPIC",op,2)    | ,                             01100000
  7292.                 Abbrev("PATH",op,1)     Then Do                         01110000
  7293.                     path = options                                      01120000
  7294.                     options = ""                                        01130000
  7295.                     End  /*  When  ..  Do  */                           01140000
  7296.         When    Abbrev("TUBE",op,2)     Then                            01150000
  7297.                     Parse Var options tube options                      01160000
  7298.         When    Abbrev("BOOKMARK",op,1) | ,                             01170000
  7299.                 Abbrev("BKMARK",op,3)   Then                            01180000
  7300.                     Parse Var options bookmark options                  01190000
  7301.         When    Abbrev("BOOKLIST",op,5) | ,                             01200000
  7302.                 Abbrev("BKLIST",op,3)   Then Do                         01210000
  7303.                     bkl = 1                                             01220000
  7304.                     End  /*  When  ..  Do  */                           01230000
  7305.         When    Abbrev("TITLE",1)       Then Do                         01240000
  7306.                     name = options                                      01250000
  7307.                     options = ""                                        01260000
  7308.                     End  /*  When  ..  Do  */                           01270000
  7309.         Otherwise 'XMITMSG 3 OP (ERRMSG'                                01280000
  7310.         End  /*  Select  op  */                                         01290000
  7311.     End  /*  Do  While  */                                              01300000
  7312.                                                                         01310000
  7313. /*  initialize many GlobalVs,  including screen stem  */                01320000
  7314. 'EXEC GOPCLINI' tube                                                    01330000
  7315.                                                                         01340000
  7316. /*  Now go display first menu or file or bookmark  */                   01350000
  7317. Select                                                                  01360000
  7318.     When    bkl         Then Call BOOKLIST                              01370000
  7319.     When bookmark ^= "" Then Call BOOKMARK                              01380000
  7320.     Otherwise                Call SHOWITEM                              01390000
  7321.     End  /*  Select  */                                                 01400000
  7322.                                                                         01410000
  7323. /*  clear some work GlobalVs  */                                        01420000
  7324. 'GLOBALV SELECT GOPHER SET PROGID'                                      01430000
  7325. 'GLOBALV SELECT GOPHER SET GOPHER'                                      01440000
  7326. 'GLOBALV SELECT GOPHER SET TUBE'                                        01450000
  7327. 'GLOBALV SELECT GOPHER SET ITEM'                                        01460000
  7328. 'GLOBALV SELECT GOPHER SET COMMAND QUIT'        /* no recursion here */ 01470000
  7329.                                                                         01480000
  7330. Exit                                                                    01490000
  7331.                                                                         01500000
  7332.                                                                         01510000
  7333.                                                                         01520000
  7334. /* ------------------------------------------------------------ SHOWITEM01530000
  7335.  */                                                                     01540000
  7336. SHOWITEM:                                                               01550000
  7337.                                                                         01560000
  7338. If host = "" Then 'GLOBALV SELECT GOPHER GET HOST'                      01570000
  7339. If host = "" Then host = "gopher.tc.umn.edu"                            01580000
  7340.                                                                         01590000
  7341. If port = "" Then 'GLOBALV SELECT GOPHER GET PORT'                      01600000
  7342. If port = "" Then port = 70                                             01610000
  7343.                                                                         01620000
  7344. If name = "" Then Do                                                    01630000
  7345.     Parse Value Reverse(path) With name '/' .                           01640000
  7346.     name = Reverse(name)                                                01650000
  7347.     End  /*  If  ..  Do  */                                             01660000
  7348.                                                                         01670000
  7349. If name = "" Then Do                                                    01680000
  7350.     'PIPE COMMAND XMITMSG 4 (APPLID GOP CALLER CLI | VAR NAME'          01690000
  7351.     Parse Var name . name                                               01700000
  7352.     End  /*  If  ..  Do  */                                             01710000
  7353.                                                                         01720000
  7354. type = Left(path,1)                                                     01730000
  7355. If type = '/' | type = ' ' Then type = '1'                              01740000
  7356.                                                                         01750000
  7357. item = type || name || '05'x || path || '05'x ,                         01760000
  7358.             || host || '05'x || port || '05'x                           01770000
  7359. 'PIPE VAR ITEM | GOPCLITM OPEN | CONSOLE'                               01780000
  7360.                                                                         01790000
  7361. Return                                                                  01800000
  7362.                                                                         01810000
  7363.                                                                         01820000
  7364.                                                                         01830000
  7365. /* ------------------------------------------------------------ BOOKMARK01840000
  7366.  *  Present the selected bookmark or fall-back to the list of all.      01850000
  7367.  */                                                                     01860000
  7368. BOOKMARK:                                                               01870000
  7369.                                                                         01880000
  7370. /*  if bookmark was specified numeric,  just fetch it  */               01890000
  7371. If Datatype(bookmark,'N') Then Do                                       01900000
  7372.     i = Trunc(bookmark)                                                 01910000
  7373.     'PIPE COMMAND GLOBALV SELECT GOPHER GET BOOKMARK.' || i             01920000
  7374.     If bookmark.i ^= "" Then Do                                         01930000
  7375.         'PIPE VAR BOOKMARK.' || i '| GOPCLITM OPEN | CONSOLE'           01940000
  7376.         Return                                                          01950000
  7377.         End  /*  If  ..  Do  */                                         01960000
  7378.     End  /*  If  ..  Do  */                                             01970000
  7379.                                                                         01980000
  7380.                                                                         01990000
  7381.                                                                         02000000
  7382. /* ------------------------------------------------------------ BOOKLIST02010000
  7383.  *  Present a menu of all of the user's bookmarks.                      02020000
  7384.  */                                                                     02030000
  7385. BOOKLIST:                                                               02040000
  7386.                                                                         02050000
  7387. If name = "" Then Do                                                    02060000
  7388.     /*  extract personal name from NAMES file  */                       02070000
  7389.     Parse Value Diag(08,'QUERY USERID') With user . host . '15'x .      02080000
  7390.     'PIPE COMMAND NAMEFIND :USERID' user ':NODE' host ,                 02090000
  7391.         ':NAME | VAR PERSONAL'                                          02100000
  7392.     If rc = 0 & personal ^= "" Then                                     02110000
  7393.         /*  make a title line for bookmark list  */                     02120000
  7394.         'PIPE COMMAND XMITMSG 40 PERSONAL' ,                            02130000
  7395.             '(APPLID GOP CALLER CLI NOHEADER | VAR NAME'                02140000
  7396.     End  /*  If  ..  Do  */                                             02150000
  7397.                                                                         02160000
  7398. /*  extract bookmarks from GlobalVs  */                                 02170000
  7399. 'PIPE COMMAND GLOBALV SELECT GOPHER LIST' ,                             02180000
  7400.         '| LOCATE 1-10 / BOOKMARK./ | SPEC /=/ 1 2-* NEXT | VARLOAD'    02190000
  7401. If ^Datatype(bookmark.0,'N') Then bookmark.0 = 0                        02200000
  7402.                              Else bookmark.0 = Trunc(bookmark.0)        02210000
  7403.                                                                         02220000
  7404. 'PIPE STEM BOOKMARK. | GOPCLIMB' name '| CONSOLE'                       02230000
  7405. If rc ^= 0 Then Return                                                  02240000
  7406.                                                                         02250000
  7407. 'GLOBALV SELECT GOPHER GET COMMAND'                                     02260000
  7408. Parse Upper Var command verb .                                          02270000
  7409. If Abbrev("QUIT",verb,1) Then Return                                    02280000
  7410.                                                                         02290000
  7411. /*  remove any blanked (deleted) bookmarks from the stem  */            02300000
  7412. j = 0                                                                   02310000
  7413. 'GLOBALV SELECT GOPHER GET BOOKMARK.0'                                  02320000
  7414. Do i = 1 to bookmark.0                                                  02330000
  7415.     'GLOBALV SELECT GOPHER GET BOOKMARK.' || i                          02340000
  7416.     If  Symbol("BOOKMARK." || i) = "LIT"    | ,                         02350000
  7417.                       bookmark.i = ""       | ,                         02360000
  7418.                  Left(bookmark.i,1) = 'i'   Then    Iterate             02370000
  7419.     j = j + 1                                                           02380000
  7420.     bookmark.j = bookmark.i                                             02390000
  7421.     'GLOBALV SELECT GOPHER PUTP BOOKMARK.' || j                         02400000
  7422.     End                                                                 02410000
  7423. bookmark.0 = j                                                          02420000
  7424. 'GLOBALV SELECT GOPHER PUTP BOOKMARK.0'                                 02430000
  7425.                                                                         02440000
  7426. Return                                                                  02450000
  7427.                                                                         02460000
  7428. :READ  GOPCLINI $EXEC    A1 TMP200 01/25/93 15:25:45                            
  7429. /*                                                                      00010000
  7430.  *        Name: GOPCLINI EXEC                                           00020000
  7431.  *              CMS InterNet Gopher (client) initialization             00030000
  7432.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  7433.  *        Date: 1992-Dec-23, 1993-Jan-22                                00050000
  7434.  */                                                                     00060000
  7435.                                                                         00070000
  7436. /*                                                                      00080000
  7437.  *      Copyright 1992 Richard M. Troth.   This software was developed  00090000
  7438.  *      with resources provided by Rice University and is intended      00100000
  7439.  *      to serve Rice's user community.   Rice has benefitted greatly   00110000
  7440.  *      from the free distribution of software,  therefore distribution 00120000
  7441.  *      of unmodified copies of this material is not restricted.        00130000
  7442.  *      You may change your own copy as needed.   Neither Rice          00140000
  7443.  *      University nor any of its employees or students shall be held   00150000
  7444.  *      liable for damages resulting from the use of this software.     00160000
  7445.  */                                                                     00170000
  7446.                                                                         00180000
  7447. Trace "OFF"                                                             00190000
  7448.                                                                         00200000
  7449. Address "COMMAND"                                                       00210000
  7450.                                                                         00220000
  7451. Parse Upper Arg . '(' opts ')' .                                        00230000
  7452. fsin = 1;   load = 1                                                    00240000
  7453. Do While opts ^= ""                                                     00250000
  7454.     Parse Var opts op opts                                              00260000
  7455.     Select  /*  op  */                                                  00270000
  7456.         When  Abbrev("UNLOAD",op,3)     Then  Signal  UNLOAD            00280000
  7457.         When  Abbrev("NOSCREEN",op,3)   Then  fsin = 0                  00290000
  7458.         When  Abbrev("NOLOAD",op,3)     Then  load = 0                  00300000
  7459.         When  Abbrev("SCREEN",op,3)     Then  fsin = 1                  00310000
  7460.         When  Abbrev("LOAD",op,1)       Then  load = 1                  00320000
  7461.         Otherwise 'XMITMSG 3 OP (ERRMSG'                                00330000
  7462.         End  Select  /*  op  */                                         00340000
  7463.     End  /*  Do  While  */                                              00350000
  7464.                                                                         00360000
  7465. 'SET LANGUAGE (ADD GOP USER'                                            00370000
  7466. If rc ^= 0 Then Exit rc                                                 00380000
  7467.                                                                         00390000
  7468. /*  fetch the program ID string  */                                     00400000
  7469. 'PIPE COMMAND XMITMSG 0 (APPLID GOP CALLER CLI NOHEADER | VAR PROGID'   00410000
  7470.                                                                         00420000
  7471. /*  migrate old bookmarks  */                                           00430000
  7472. 'EXEC GOPHMARK'                                                         00440000
  7473.                                                                         00450000
  7474. Parse Upper Arg tube . '(' . ')' .                                      00460000
  7475.                                                                         00470000
  7476. 'GLOBALV SELECT GOPHER PUT GOPHER PROGID TUBE'                          00480000
  7477. 'GLOBALV SELECT GOPHER SET ITEM'                                        00490000
  7478. 'GLOBALV SELECT GOPHER SET COMMAND'                                     00500000
  7479.                                                                         00510000
  7480. /*  initialize screen variables  */                                     00520000
  7481. If fsin Then Do                                                         00530000
  7482.     If ^Datatype(tube,'X') Then 'VMFCLEAR'      /*  clear if cons  */   00540000
  7483.     Call FSINIT tube            /*  figure out some screen attribs  */  00550000
  7484.     'PIPE REXXVARS | DROP | JOIN 1 /,/ | LOCATE /n FS./' ,              00560000
  7485.             '| CHANGE /n /GLOBALV SELECT GOPHER SETL / 1' ,             00570000
  7486.                     '| CHANGE /,v / / 1 | COMMAND'                      00580000
  7487.     End  /*  If  ..  Do  */                                             00590000
  7488.                                                                         00600000
  7489. /*  load client gems into memory for efficiency  */                     00610000
  7490. If load Then                                                            00620000
  7491. 'PIPE CMS L GOPCLI* REXX * | SPEC /EXECLOAD / 1 1-* NEXT | COMMAND'     00630000
  7492.                                                                         00640000
  7493. Exit                                                                    00650000
  7494.                                                                         00660000
  7495.                                                                         00670000
  7496.                                                                         00680000
  7497. /* -------------------------------------------------------------- FSINIT00690000
  7498.  * Initialize variables used in building screen displays.               00700000
  7499.  * (this code comes from Chuck Boeheim's PIPEDEMO; Thanks, Chuck!)      00710000
  7500.  */                                                                     00720000
  7501. FSINIT:   Procedure Expose fs.                                          00730000
  7502. Parse Arg t                                                             00740000
  7503. fs.tube = t                                                             00750000
  7504.                                                                         00760000
  7505. If Datatype(fs.tube,'X') Then Do                                        00770000
  7506.                                                                         00780000
  7507.     /*----------------------------------------------------------------*/00790000
  7508.     /*  a dialed 3270 with pessimistic assumptions                    */00800000
  7509.     /*----------------------------------------------------------------*/00810000
  7510.                                                                         00820000
  7511.     fs.scrrows = 24                                                     00830000
  7512.     fs.scrcols = 80                                                     00840000
  7513.     fs.write  = '80'x                                                   00850000
  7514.     flags = '00'x                                                       00860000
  7515.                                                                         00870000
  7516.     End  /*  If  ..  Do  */                                             00880000
  7517.                                                                         00890000
  7518. Else Do                                                                 00900000
  7519.                                                                         00910000
  7520.     /*----------------------------------------------------------------*/00920000
  7521.     /*  Get the screen size from CP.                                  */00930000
  7522.     /*----------------------------------------------------------------*/00940000
  7523.                                                                         00950000
  7524.     Parse Value Diag('8C') with flags +1 3 fs.scrcols +2 fs.scrrows +2 .00960000
  7525.     fs.scrrows = c2d(fs.scrrows)                                        00970000
  7526.     fs.scrcols = c2d(fs.scrcols)                                        00980000
  7527.                                                                         00990000
  7528.     If  fs.scrrows > 24 | fs.scrcols > 80   Then fs.write = 'C0'x       01000000
  7529.                                             Else fs.write = '80'x       01010000
  7530.                                                                         01020000
  7531.     End  /*  Else  Do  */                                               01030000
  7532.                                                                         01040000
  7533. fs.operwa = 'C0'x       /* Erase/Write alternate      */                01050000
  7534. fs.operw  = '80'x       /* Erase/Write                */                01060000
  7535. fs.opwr   = '00'x       /* Write                      */                01070000
  7536. fs.oprd   = '06'x       /* Read modified.             */                01080000
  7537.                                                                         01090000
  7538. fs.wcc    = '03'x       /* Unlock keyboard, reset mdt */                01100000
  7539.                                                                         01110000
  7540. fs.high   = '1DE8'x     /* Protected, highlighted.    */                01120000
  7541. fs.low    = '1D60'x     /* Protected, normal.         */                01130000
  7542. fs.ic     = '13'x       /* Insert cursor.             */                01140000
  7543.                                                                         01150000
  7544. fs.color = (bitand(flags,'80'x) = '80'x)                                01160000
  7545. fs.exthi = (bitand(flags,'40'x) = '40'x)                                01170000
  7546. fs.pss   = (bitand(flags,'20'x) = '20'x)                                01180000
  7547. fs.7171  = (bitand(flags,'02'x) = '02'x)                                01190000
  7548. fs.14bit = (bitand(flags,'01'x) = '01'x)                                01200000
  7549.                                                                         01210000
  7550. Return                                                                  01220000
  7551.                                                                         01230000
  7552.                                                                         01240000
  7553.                                                                         01250000
  7554. /* -------------------------------------------------------------- UNLOAD01260000
  7555.  *  Unload Gopher EXECs, pipeline stages, messages to free-up memory.   01270000
  7556.  */                                                                     01280000
  7557. UNLOAD:                                                                 01290000
  7558.                                                                         01300000
  7559. 'PIPE COMMAND EXECMAP | LOCATE 1.3 /GOP/' ,                             01310000
  7560.         '| SPEC /EXECDROP / 1 1.20 NEXT | COMMAND'                      01320000
  7561. If rc ^= 0 Then Exit rc                                                 01330000
  7562.                                                                         01340000
  7563. 'SET LANGUAGE (DELETE GOP USER'                                         01350000
  7564.                                                                         01360000
  7565. If rc ^= 0 Then Exit rc                                                 01370000
  7566.                                                                         01380000
  7567. Exit                                                                    01390000
  7568.                                                                         01400000
  7569. :READ  GOPCLISX $REXX    A1 TMP200 01/25/93 15:25:42                            
  7570. /*                                                                      00010000
  7571.  *        Name: GOPCLISX REXX                                           00020000
  7572.  *              CMS Gopher client TCP/IP (sockets; "sox") function      00030000
  7573.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  7574.  *        Date: 1992-Dec-23                                             00050000
  7575.  *                                                                      00060000
  7576.  *       Input: one or more gopher menu lines                           00070000
  7577.  *    Output 0: zero or more blocks of raw (may be ASCII) data          00080000
  7578.  *    Output 1: status messages and/or error messages                   00090000
  7579.  *                                                                      00100000
  7580.  *        Note: input is "plain text" (EBCDIC),  while output           00110000
  7581.  *              may be anything.   If output is "plain text" (ASCII),   00120000
  7582.  *              the following stage must handle translation.            00130000
  7583.  */                                                                     00140000
  7584.                                                                         00150000
  7585. /*                                                                      00160000
  7586.  *      Copyright 1992 Richard M. Troth.   This software was developed  00170000
  7587.  *      with resources provided by Rice University and is intended      00180000
  7588.  *      to serve Rice's user community.   Rice has benefitted greatly   00190000
  7589.  *      from the free distribution of software,  therefore distribution 00200000
  7590.  *      of unmodified copies of this material is not restricted.        00210000
  7591.  *      You may change your own copy as needed.   Neither Rice          00220000
  7592.  *      University nor any of its employees or students shall be held   00230000
  7593.  *      liable for damages resulting from the use of this software.     00240000
  7594.  */                                                                     00250000
  7595.                                                                         00260000
  7596. Trace "OFF"                                                             00270000
  7597.                                                                         00280000
  7598. /*  sync with input so that 'CALLPIPE COMMAND' will work  */            00290000
  7599. 'PEEKTO'                                                                00300000
  7600.                                                                         00310000
  7601. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER GET GOPHER'                     00320000
  7602. If gopher = "" Then gopher = "Gopher"                                   00330000
  7603. quit = 0                                                                00340000
  7604.                                                                         00350000
  7605. Parse Arg . '(' opts ')' .                                              00360000
  7606.                                                                         00370000
  7607. trans = 0                                                               00380000
  7608. Do While opts ^= ""                                                     00390000
  7609.     Parse Var opts op opts                                              00400000
  7610.     Upper op                                                            00410000
  7611.     Select  /*  op  */                                                  00420000
  7612.         When Abbrev("TRANSLATE",op,4) Then trans = 1                    00430000
  7613.         When Abbrev("NOTRANSLATE",op,6) Then trans = 0                  00440000
  7614.         Otherwise Address "COMMAND" 'XMITMSG 3 OP (ERRMSG'              00450000
  7615.         End  /*  Select  op  */                                         00460000
  7616.     End  /*  Do  While  */                                              00470000
  7617.                                                                         00480000
  7618. If trans Then crlf = '0D25'x                                            00490000
  7619.          Else crlf = '0D0A'x                                            00500000
  7620.                                                                         00510000
  7621. /*                                                                      00520000
  7622.  *   Initialize RXSOCKET                                                00530000
  7623.  */                                                                     00540000
  7624. maxdesc = Socket('Initialize', gopher)                                  00550000
  7625. If maxdesc = "-1" Then Do                                               00560000
  7626.     If errno ^= "ESUBTASKALREADYACTIVE" Then Do                         00570000
  7627.     /*  Call STATUS tcperror()  */                                      00580000
  7628.         Exit -1                                                         00590000
  7629.         End  /*  If  ..  Do  */                                         00600000
  7630.     rc = Socket('Terminate')                                            00610000
  7631.     maxdesc = Socket('Initialize', gopher)                              00620000
  7632.     If maxdesc = "-1" Then Do                                           00630000
  7633.         Call STATUS tcperror()                                          00640000
  7634.         Exit -1                                                         00650000
  7635.         End  /*  If  ..  Do  */                                         00660000
  7636.     End  /*  If  ..  Do  */                                             00670000
  7637.                                                                         00680000
  7638. /*  L O O P  */                                                         00690000
  7639.                                                                         00700000
  7640. Do Forever                                                              00710000
  7641.                                                                         00720000
  7642.     'PEEKTO ITEM'                                                       00730000
  7643.     If rc ^= 0 Then Leave                                               00740000
  7644.                                                                         00750000
  7645.     Parse Var item 1 type 2 name '05'x path '05'x host ,                00760000
  7646.                                  '05'x port '05'x xtra                  00770000
  7647.     port = Strip(port)              /*  for robustness  */              00780000
  7648.     If type = '7' Then path = path || '05'x || xtra                     00790000
  7649.                                                                         00800000
  7650.     /*  Call STATUS "Connecting ... press ENTER twice to abort"  */     00810000
  7651.     /*  Call STATUS "Connecting to" host "port" port  */                00820000
  7652.     Call STATUS 22 '"' || host || '"' '"' || port || '"'                00830000
  7653.                                                                         00840000
  7654.     /*                                                                  00850000
  7655.      *   Request a new socket descriptor (TCP protocol)                 00860000
  7656.      */                                                                 00870000
  7657.     socket = Socket('Socket', 'AF_INET', 'Sock_Stream')                 00880000
  7658.     If socket = "-1" Then Do                                            00890000
  7659.         Call STATUS tcperror()                                          00900000
  7660.         Exit -1                                                         00910000
  7661.         End  /*  If  ..  Do  */                                         00920000
  7662.                                                                         00930000
  7663.     If trans Then Do                                                    00940000
  7664.         /*                                                              00950000
  7665.          *   Enable ASCII<->EBCDIC Translation Option                   00960000
  7666.          */                                                             00970000
  7667.         rc = Socket('SetSockOpt', socket, 'SOL_SOCKET', 'SO_EBCDIC', 1) 00980000
  7668.         If rc = "-1" Then Do                                            00990000
  7669.             Call STATUS tcperror()                                      01000000
  7670.             Exit -1                                                     01010000
  7671.             End  /*  If  ..  Do  */                                     01020000
  7672.         End  /*  If  ..  Do  */                                         01030000
  7673.                                                                         01040000
  7674.     /*                                                                  01050000
  7675.      *   Connect to the server                                          01060000
  7676.      */                                                                 01070000
  7677.     Parse Var host h1 '.' h2 '.' h3 '.' h4 '.' .                        01080000
  7678.     If  Datatype(h1,'N') &,                                             01090000
  7679.         Datatype(h2,'N') &,                                             01100000
  7680.         Datatype(h3,'N') &,                                             01110000
  7681.         Datatype(h4,'N')    Then                                        01120000
  7682.         hisaddr = d2c(h1) || d2c(h2) || d2c(h3) || d2c(h4)              01130000
  7683.     Else Do                                                             01140000
  7684.         hisaddr = Socket('GetHostByName', host)                         01150000
  7685.         If hisaddr = "-1" Then Do                                       01160000
  7686.         Call STATUS tcperror()                                          01170000
  7687.             Exit -1                                                     01180000
  7688.             End  /*  If  ..  Do  */                                     01190000
  7689.         End  /*  Else  Do  */                                           01200000
  7690.                                                                         01210000
  7691.     /*  Parse Var hisaddr h1 +1 h2 +1 h3 +1 h4 +1 .  */                 01220000
  7692.                                                                         01230000
  7693.     name = AF_INET || Htons(port) || hisaddr                            01240000
  7694.                                                                         01250000
  7695.     /*                                                                  01260000
  7696.      *   Set this socket to non-blocking mode                           01270000
  7697.      */                                                                 01280000
  7698.     rc = Socket('Ioctl', socket, 'FIONBIO', 1)                          01290000
  7699.     If rc="-1" Then Do                                                  01300000
  7700.         Call STATUS tcperror()                                          01310000
  7701.         Exit -1                                                         01320000
  7702.         End  /*  If  ..  Do  */                                         01330000
  7703.                                                                         01340000
  7704.     /*                                                                  01350000
  7705.      *   Connect to the host                                            01360000
  7706.      */                                                                 01370000
  7707.     rc = Socket('Connect', socket, name)                                01380000
  7708.     If rc = "-1" Then ,                                                 01390000
  7709.         If errno ^= "EINPROGRESS" Then Do                               01400000
  7710.             Call STATUS tcperror()                                      01410000
  7711.             If errno = "ECONNREFUSED" Then ,                            01420000
  7712.                 Call STATUS 23 '"' || host || '"' '"' || port || '"'    01430000
  7713.         Exit -1                                                         01440000
  7714.         End  /*  If  ..  Do  */                                         01450000
  7715.                                                                         01460000
  7716.     rc = FD_ZERO('readmask')                                            01470000
  7717.     rc = FD_ZERO('writemask')                                           01480000
  7718.     rc = FD_SET(socket,'writemask')                                     01490000
  7719.     rc = FD_SET('0', 'readmask')                                        01500000
  7720.                                                                         01510000
  7721.     rc = Socket('Select', socket+1, 'readmask', 'writemask', 0, 20)     01520000
  7722.     If rc="-1" Then Do                                                  01530000
  7723.         Call STATUS tcperror()                                          01540000
  7724.         Exit -1                                                         01550000
  7725.         End  /*  If  ..  Do  */                                         01560000
  7726.                                                                         01570000
  7727.     If FD_ISSET('0', 'readmask')<>0 Then Do                             01580000
  7728.         rc = Socket('Close', socket)                                    01590000
  7729.         /*  Call STATUS "Connection canceled by user request"  */       01600000
  7730.         Call STATUS 28                                                  01610000
  7731.         Exit -1                                                         01620000
  7732.         End                                                             01630000
  7733.                                                                         01640000
  7734.     If FD_ISSET(socket, 'writemask')=0 Then Do                          01650000
  7735.         rc = Socket('Close', socket)                                    01660000
  7736.         /*  Call STATUS "Connection canceled by TIMEOUT"  */            01670000
  7737.         Call STATUS 29                                                  01680000
  7738.         Exit -1                                                         01690000
  7739.         end                                                             01700000
  7740.                                                                         01710000
  7741.     /* Return to standard mode                                          01720000
  7742.     rc = Socket('Ioctl', socket, 'FIONBIO', 0)                          01730000
  7743.      */                                                                 01740000
  7744.                                                                         01750000
  7745.     /*  TRANSlate option will affect both writing to,  as well as     * 01760000
  7746.      *  reading from,  the socket.   So if the socket is set for      * 01770000
  7747.      *  TRANSLATE,  then we need not translate the path from EBCDIC   * 01780000
  7748.      *  to ASCII.   But if not,  then we must do so as follows:       */01790000
  7749.     If ^trans Then                                                      01800000
  7750.     'CALLPIPE VAR PATH | TCPE2A' gopher '| VAR PATH'                    01810000
  7751.                                                                         01820000
  7752.     /*                                                                  01830000
  7753.      *   Send the "query" to the server                                 01840000
  7754.      */                                                                 01850000
  7755.     bytes_out = Socket('Write', socket, path || crlf)                   01860000
  7756.     If bytes_out = "-1" Then Do                                         01870000
  7757.         If errno = 'EPIPE' Then ,                                       01880000
  7758.             'OUTPUT' "ECONNREFUSED"                                     01890000
  7759.         If errno = 'EPIPE' Then ,                                       01900000
  7760.             Call STATUS 23 '"' || host || '"' '"' || port || '"'        01910000
  7761.         Else Call STATUS tcperror()                                     01920000
  7762.         Exit -1                                                         01930000
  7763.         End  /*  If  ..  Do  */                                         01940000
  7764.                                                                         01950000
  7765.     /*  Call STATUS "Reading ... press ENTER twice to abort"  */        01960000
  7766.     /*  Call STATUS "Reading ... "  */                                  01970000
  7767.     /*  Call STATUS 24  */                                              01980000
  7768.                                                                         01990000
  7769.     totbytes = 0                                                        02000000
  7770. prevtot = 0                                                             02010000
  7771.     /*                                                                  02020000
  7772.      *   Loop, reading response and sending to the next pipeline stage  02030000
  7773.      */                                                                 02040000
  7774.     Do Forever                                                          02050000
  7775.         /* Set up to trap console ENTER key */                          02060000
  7776.         rc = FD_ZERO('readmask')                                        02070000
  7777.         rc = FD_SET('0','readmask')                                     02080000
  7778.         rc = FD_SET(socket,'readmask')                                  02090000
  7779.                                                                         02100000
  7780.         /* Wait for something to happen */                              02110000
  7781.         rc = Socket('Select',socket+1,'readmask',0,0)                   02120000
  7782.         /* If console input, clear 'socket' and return */               02130000
  7783.         If FD_ISSET('0','readmask')<>0 Then Do                          02140000
  7784.             /*  Call STATUS "Request ABORTED"  */                       02150000
  7785.             Call STATUS 27                                              02160000
  7786.             rc = Socket('Close', socket)                                02170000
  7787.             Leave                                                       02180000
  7788.             End                                                         02190000
  7789.                                                                         02200000
  7790.         bytes_in = Socket('Read', socket, 'pack')                       02210000
  7791.         If bytes_in = "-1" Then                                         02220000
  7792.             Call STATUS tcperror()                                      02230000
  7793.         If bytes_in < 1 Then Leave                                      02240000
  7794.                                                                         02250000
  7795.         totbytes = totbytes + bytes_in                                  02260000
  7796. If prevtot/totbytes < 0.9 Then  /* adjust the 0.9 factor to taste */    02270000
  7797. Do                                                                      02280000
  7798.         Call STATUS 26 '"' || totbytes || '"'                           02290000
  7799. prevtot = totbytes                                                      02300000
  7800. End                                                                     02310000
  7801.         'OUTPUT' pack                                                   02320000
  7802.         If rc ^= 0 Then Leave                                           02330000
  7803.                                                                         02340000
  7804.         End  /*  Do  Forever  */                                        02350000
  7805.                                                                         02360000
  7806.     If rc ^= 0 Then Leave                                               02370000
  7807.                                                                         02380000
  7808.     /*                                                                  02390000
  7809.      *   All done, relinquish our socket descriptor                     02400000
  7810.      */                                                                 02410000
  7811.     rc = Socket('Close', socket)                                        02420000
  7812.     If rc = "-1" Then Do                                                02430000
  7813.         Call STATUS tcperror()                                          02440000
  7814.         Leave                                                           02450000
  7815.         End  /*  If  ..  Do  */                                         02460000
  7816.                                                                         02470000
  7817.     'READTO'                                                            02480000
  7818.                                                                         02490000
  7819.     End  /*  Do  Forever  */                                            02500000
  7820.                                                                         02510000
  7821. /*                                                                      02520000
  7822.  *   Tell RXSOCKET that we are done with this IUCV path                 02530000
  7823.  */                                                                     02540000
  7824. rc = Socket('Terminate')                                                02550000
  7825. If rc = "-1" Then Do                                                    02560000
  7826.     Call STATUS tcperror()                                              02570000
  7827.     Exit -1                                                             02580000
  7828.     End                                                                 02590000
  7829.                                                                         02600000
  7830. /*  an empty line as last in status stream indicates success  */        02610000
  7831. /*  Call STATUS " "  */                                                 02620000
  7832.                                                                         02630000
  7833. Exit                                                                    02640000
  7834.                                                                         02650000
  7835.                                                                         02660000
  7836.                                                                         02670000
  7837. /* -------------------------------------------------------------- STATUS02680000
  7838.  * Write  "status messages"  to the secondary stream,  if connected.    02690000
  7839.  * This routine saves & restores the current stream selection.          02700000
  7840.  * (though there are presently no other streams used besides 1 and 0)   02710000
  7841.  */                                                                     02720000
  7842. STATUS:   Procedure                                                     02730000
  7843. Parse Arg string                                                        02740000
  7844.                                                                         02750000
  7845. /* note the current stream (should be zero) */                          02760000
  7846. 'STREAMNO OUTPUT'                                                       02770000
  7847. If rc < 0 Then Return                                                   02780000
  7848. stream = rc                                                             02790000
  7849.                                                                         02800000
  7850. /* select secondary stream and output the string */                     02810000
  7851. 'SELECT OUTPUT 1'                                                       02820000
  7852. If rc ^= 0 Then Return                                                  02830000
  7853. If Datatype(Word(string,1),'N') Then                                    02840000
  7854. 'CALLPIPE COMMAND XMITMSG' string '(APPLID GOP CALLER TCP ERRMSG | *:'  02850000
  7855. Else 'OUTPUT' string                                                    02860000
  7856. 'SELECT OUTPUT' stream                                                  02870000
  7857.                                                                         02880000
  7858. Return                                                                  02890000
  7859.                                                                         02900000
  7860. :READ  GOPCLITM $REXX    A1 TMP200 01/25/93 15:25:39                            
  7861. /*                                                                      00010000
  7862.  *        Name: GOPCLITM REXX                                           00020000
  7863.  *              VM TCP/IP Network GOPHER Client item processor          00030000
  7864.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  7865.  *        Date: 1992-Dec-23                                             00050000
  7866.  *                                                                      00060000
  7867.  *       Input: one or more gopher menu lines                           00070000
  7868.  *      Output: zero or more information or error messages              00080000
  7869.  *              (EOF does not propagate back to input)                  00090000
  7870.  */                                                                     00100000
  7871.                                                                         00110000
  7872. /*                                                                      00120000
  7873.  *      Copyright 1992 Richard M. Troth.   This software was developed  00130000
  7874.  *      with resources provided by Rice University and is intended      00140000
  7875.  *      to serve Rice's user community.   Rice has benefitted greatly   00150000
  7876.  *      from the free distribution of software,  therefore distribution 00160000
  7877.  *      of unmodified copies of this material is not restricted.        00170000
  7878.  *      You may change your own copy as needed.   Neither Rice          00180000
  7879.  *      University nor any of its employees or students shall be held   00190000
  7880.  *      liable for damages resulting from the use of this software.     00200000
  7881.  */                                                                     00210000
  7882.                                                                         00220000
  7883. Trace "OFF"                                                             00230000
  7884.                                                                         00240000
  7885. Parse Upper Arg disp . '(' . ')' .                                      00250000
  7886. If disp = "" Then disp = "OPEN"                                         00260000
  7887. /*  Say open  */                                                        00270000
  7888.                                                                         00280000
  7889. /*  sync with input so that 'CALLPIPE COMMAND' will work  */            00290000
  7890. 'PEEKTO'                                                                00300000
  7891.                                                                         00310000
  7892. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER GET GOPHER PROGID'              00320000
  7893.                                                                         00330000
  7894. /*  fetch fs. stem variable from GlobalVs  */                           00340000
  7895. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER LIST | DROP' ,                  00350000
  7896.         '| LOCATE 1-4 / FS./ | SPEC /=/ 1 2-* NEXT | VARLOAD'           00360000
  7897. If ^Datatype(fs.tube,'X') Then fs.tube = ""                             00370000
  7898.                                                                         00380000
  7899. /*  prepare for dynamic connection statistics  */                       00390000
  7900. stat = 'STEM STAT. | GOPCLIST'                                          00400000
  7901.                                                                         00410000
  7902. Do Forever                                                              00420000
  7903.                                                                         00430000
  7904.     'PEEKTO ITEM'                                                       00440000
  7905.     If rc ^= 0 Then Leave                                               00450000
  7906.                                                                         00460000
  7907.     'CALLPIPE COMMAND GLOBALV SELECT GOPHER PUT ITEM'                   00470000
  7908.                                                                         00480000
  7909.     Parse Var item name '05'x path '05'x host '05'x port '05'x xtra     00490000
  7910.     Parse Var name 1 type 2 name                                        00500000
  7911.                                                                         00510000
  7912. stat.0 = 0                                                              00520000
  7913.                                                                         00530000
  7914.     Select  /*  type  */                                                00540000
  7915.                                                                         00550000
  7916.         When  type = '0'  Then  Call  OPENFILE                          00560000
  7917.                                                                         00570000
  7918.         When  type = '1'  Then  Call  OPENMENU                          00580000
  7919.                                                                         00590000
  7920.         When  type = '2'  Then  Call  LOOKUP                            00600000
  7921.                                                                         00610000
  7922.         When  type = '4'  Then  Call  OPENFILE  /* MAC */               00620000
  7923.                                                                         00630000
  7924.         When  type = '5'  Then  Call  OPENFILE  /* DOS */               00640000
  7925.                                                                         00650000
  7926.         When  type = '6'  Then  Call  OPENFILE  /* UUE */               00660000
  7927.                                                                         00670000
  7928.         When  type = '7'  Then  Call  SEARCH                            00680000
  7929.                                                                         00690000
  7930.         When  type = '8'  Then  Call  TELNET                            00700000
  7931.                                                                         00710000
  7932.         When  type = '9'  Then  Call  BINARY                            00720000
  7933.                                                                         00730000
  7934.         When  type = 'T'  Then  Call  TN3270                            00740000
  7935.                                                                         00750000
  7936.         When  type = 'r'  | ,                                           00760000
  7937.               type = 'v'  Then  Call  CMSBLOCK                          00770000
  7938.                                                                         00780000
  7939.         When  type = 'I'  | ,                                           00790000
  7940.               type = ':'  | ,                                           00800000
  7941.               type = 'g'  Then  Call  GRAPHICS                          00810000
  7942.                                                                         00820000
  7943.         Otherwise               Call  OPENFILE                          00830000
  7944.                                                                         00840000
  7945.         End  /*  Select  type  */                                       00850000
  7946.                                                                         00860000
  7947. If rc ^= 0 Then 'CALLPIPE STEM STAT. | *:'                              00870000
  7948.                                                                         00880000
  7949.     'READTO'                                                            00890000
  7950.                                                                         00900000
  7951.     End  /*  Do  Forever  */                                            00910000
  7952.                                                                         00920000
  7953. Exit rc * (rc ^= 12)                                                    00930000
  7954.                                                                         00940000
  7955.                                                                         00950000
  7956.                                                                         00960000
  7957. /* ------------------------------------------------------------ OPENFILE00970000
  7958.  *  View or retrieve a plain text file.                                 00980000
  7959.  */                                                                     00990000
  7960. OPENFILE:                                                               01000000
  7961.                                                                         01010000
  7962. filter = 'GOPCLITX'                                                     01020000
  7963.                                                                         01030000
  7964. If disp = "KEEP" Then Signal KEEPFILE                                   01040000
  7965.                                                                         01050000
  7966. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                             01060000
  7967.     '| GOPCLITX | GOPCLIFV | *:' ,                                      01070000
  7968.     '! E: |' stat                                                       01080000
  7969.                                                                         01090000
  7970. Return                                                                  01100000
  7971.                                                                         01110000
  7972.                                                                         01120000
  7973.                                                                         01130000
  7974. /* ------------------------------------------------------------ OPENMENU01140000
  7975.  *  View or retrieve a plain text file.                                 01150000
  7976.  */                                                                     01160000
  7977. OPENMENU:                                                               01170000
  7978.                                                                         01180000
  7979. filter = 'GOPCLITX'                                                     01190000
  7980.                                                                         01200000
  7981. If disp = "KEEP" Then Signal KEEPFILE                                   01210000
  7982.                                                                         01220000
  7983. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                             01230000
  7984.     '| GOPCLITX | GOPCLIMB | *:' ,                                      01240000
  7985.     '! E: |' stat                                                       01250000
  7986.                                                                         01260000
  7987. Return                                                                  01270000
  7988.                                                                         01280000
  7989.                                                                         01290000
  7990.                                                                         01300000
  7991. /* -------------------------------------------------------------- LOOKUP01310000
  7992.  *  Perform user lookup.   (punt to PH EXEC or equivalent)              01320000
  7993.  */                                                                     01330000
  7994. LOOKUP:                                                                 01340000
  7995.                                                                         01350000
  7996. host = Strip(host)                                                      01360000
  7997. port = Strip(port)                                                      01370000
  7998. 'CALLPIPE COMMAND GLOBALV SELECT PHCMS PUT HOST PORT'                   01380000
  7999. Address "CMS" 'PH'                                                      01390000
  8000.                                                                         01400000
  8001. Return                                                                  01410000
  8002.                                                                         01420000
  8003.                                                                         01430000
  8004.                                                                         01440000
  8005. /* -------------------------------------------------------------- SEARCH01450000
  8006.  */                                                                     01460000
  8007. SEARCH:                                                                 01470000
  8008.                                                                         01480000
  8009. 'CALLPIPE COMMAND XMITMSG 601 (APPLID GOP NOHEADER' ,                   01490000
  8010.         '| GOPCLIUI | VAR KEYWORDS'                                     01500000
  8011. keywords = Strip(keywords)                                              01510000
  8012. If keywords = "" Then Return                                            01520000
  8013.                                                                         01530000
  8014. /*  prepend a  path<TAB>  to search string for WAIS servers  */         01540000
  8015. /*  path = path || '05'x || keywords  */                                01550000
  8016. item = item || '05'x || keywords                                        01560000
  8017.                                                                         01570000
  8018. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                             01580000
  8019.     '| GOPCLITX | GOPCLIMB | *:'                                        01590000
  8020.     '! E: |' stat                                                       01600000
  8021.                                                                         01610000
  8022. Return                                                                  01620000
  8023.                                                                         01630000
  8024.                                                                         01640000
  8025.                                                                         01650000
  8026. /* -------------------------------------------------------------- TELNET01660000
  8027.  */                                                                     01670000
  8028. TELNET:                                                                 01680000
  8029.                                                                         01690000
  8030. If fs.tube ^= "" Then Do                                                01700000
  8031.     /*  'OUTPUT' "Can't TELNET from this screen"  */                    01710000
  8032.     'CALLPIPE COMMAND XMITMSG 512 "TELNET"' ,                           01720000
  8033.             '(APPLID GOP CALLER CLI ERRMSG | *:'                        01730000
  8034.     Return                                                              01740000
  8035.     End /* If .. Do */                                                  01750000
  8036.                                                                         01760000
  8037. Address "COMMAND"                                                       01770000
  8038.                                                                         01780000
  8039. 'VMFCLEAR'                                                              01790000
  8040. If port = 0 Then port = ""                                              01800000
  8041. /*  Say progid "TELNET" host port  */                                   01810000
  8042. 'XMITMSG 30 HOST PORT (APPLID GOP CALLER CLI ERRMSG'                    01820000
  8043. /*  Say name  */                                                        01830000
  8044. 'XMITMSG 7 NAME (APPLID GOP CALLER CLI ERRMSG NOCOMP'                   01840000
  8045.                                                                         01850000
  8046. If path ^= "" Then Do                                                   01860000
  8047.     /*  Say "login with:" path  */                                      01870000
  8048.     'XMITMSG 32 PATH (APPLID GOP CALLER CLI NOHEADER'                   01880000
  8049.     /*  Say "Press ENTER to continue ... "  */                          01890000
  8050.     'XMITMSG 33 (APPLID GOP CALLER CLI NOHEADER'                        01900000
  8051.     Parse External                                                      01910000
  8052.     End  /*  If  ..  Do  */                                             01920000
  8053.                                                                         01930000
  8054. 'GLOBALV SELECT GOPHER GET TELNET'                                      01940000
  8055. If telnet = "" Then telnet = "TELNET"                                   01950000
  8056. Address "CMS" telnet host port                                          01960000
  8057. 'VMFCLEAR'                                                              01970000
  8058.                                                                         01980000
  8059. Address                                                                 01990000
  8060.                                                                         02000000
  8061. Return                                                                  02010000
  8062.                                                                         02020000
  8063.                                                                         02030000
  8064.                                                                         02040000
  8065. /* -------------------------------------------------------------- BINARY02050000
  8066.  *  Load a "binary" (byte stream) file onto disk.                       02060000
  8067.  */                                                                     02070000
  8068. BINARY:                                                                 02080000
  8069.                                                                         02090000
  8070. filter = ""                                                             02100000
  8071.                                                                         02110000
  8072. If disp = "KEEP" Then Signal KEEPFILE                                   02120000
  8073.                                                                         02130000
  8074. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                             02140000
  8075.     '| GOPCLIFV | *:' ,                                                 02150000
  8076.     '! E: |' stat                                                       02160000
  8077.                                                                         02170000
  8078. Return                                                                  02180000
  8079.                                                                         02190000
  8080.                                                                         02200000
  8081.                                                                         02210000
  8082. /* -------------------------------------------------------------- TN327002220000
  8083.  *  This is almost exactly the same as the  TELNET  routine,            02230000
  8084.  *  but we let the user run a different program,  specified in          02240000
  8085.  *  global variable  TN3270,  if they wish.                             02250000
  8086.  */                                                                     02260000
  8087. TN3270:                                                                 02270000
  8088.                                                                         02280000
  8089. If fs.tube ^= "" Then Do                                                02290000
  8090.     /*  'OUTPUT' "Can't TN3270 from this screen"  */                    02300000
  8091.     'CALLPIPE COMMAND XMITMSG 512 "TN3270"' ,                           02310000
  8092.             '(APPLID GOP CALLER CLI ERRMSG | *:'                        02320000
  8093.     Return                                                              02330000
  8094.     End /* If .. Do */                                                  02340000
  8095.                                                                         02350000
  8096. Address "COMMAND"                                                       02360000
  8097.                                                                         02370000
  8098. 'VMFCLEAR'                                                              02380000
  8099. If port = 0 Then port = ""                                              02390000
  8100. /*  Say progid "TN3270" host port  */                                   02400000
  8101. 'XMITMSG 31 HOST PORT (APPLID GOP CALLER CLI ERRMSG'                    02410000
  8102. /*  Say name  */                                                        02420000
  8103. 'XMITMSG 7 NAME (APPLID GOP CALLER CLI ERRMSG NOCOMP'                   02430000
  8104. If path ^= "" Then Do                                                   02440000
  8105.     /*  Say "login with:" path  */                                      02450000
  8106.     'XMITMSG 32 PATH (APPLID GOP CALLER CLI NOHEADER'                   02460000
  8107.     /*  Say "Press ENTER to continue ... "  */                          02470000
  8108.     'XMITMSG 33 (APPLID GOP CALLER CLI NOHEADER'                        02480000
  8109.     Parse External                                                      02490000
  8110.     End  /*  If  ..  Do  */                                             02500000
  8111.                                                                         02510000
  8112. 'GLOBALV SELECT GOPHER GET TN3270'                                      02520000
  8113. If tn3270 = "" Then Do                                                  02530000
  8114.     'GLOBALV SELECT GOPHER GET TELNET'                                  02540000
  8115.     If telnet = "" Then telnet = "TELNET"                               02550000
  8116.     tn3270 = telnet                                                     02560000
  8117.     End  /*  If  ..  Do  */                                             02570000
  8118. Address "CMS" tn3270 host port                                          02580000
  8119. 'VMFCLEAR'                                                              02590000
  8120.                                                                         02600000
  8121. Address                                                                 02610000
  8122.                                                                         02620000
  8123. Return                                                                  02630000
  8124.                                                                         02640000
  8125.                                                                         02650000
  8126.                                                                         02660000
  8127. /* ------------------------------------------------------------ CMSBLOCK02670000
  8128.  *  Save a record oriented file (type 'r' or type 'v') onto disk.       02680000
  8129.  */                                                                     02690000
  8130. CMSBLOCK:                                                               02700000
  8131.                                                                         02710000
  8132. filter = 'DEBLOCK CMS'                                                  02720000
  8133.                                                                         02730000
  8134. If disp = "KEEP" Then Signal KEEPFILE                                   02740000
  8135.                                                                         02750000
  8136. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                             02760000
  8137.     '| DEBLOCK CMS | GOPCLIFV | *:' ,                                   02770000
  8138.     '! E: |' stat                                                       02780000
  8139.                                                                         02790000
  8140. Return                                                                  02800000
  8141.                                                                         02810000
  8142.                                                                         02820000
  8143.                                                                         02830000
  8144. /* ------------------------------------------------------------ GRAPHICS02840000
  8145.  *  Display or save a graphics (type 'I') file.                         02850000
  8146.  */                                                                     02860000
  8147. GRAPHICS:                                                               02870000
  8148.                                                                         02880000
  8149. filter = ""     /*  same as for  "binary"  files  */                    02890000
  8150.                                                                         02900000
  8151. If disp = "KEEP" Then Signal KEEPFILE                                   02910000
  8152.                                                                         02920000
  8153. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                             02930000
  8154.         '| GOPCLIGV | *: ! E: |' stat                                   02940000
  8155.                                                                         02950000
  8156. Return                                                                  02960000
  8157.                                                                         02970000
  8158.                                                                         02980000
  8159.                                                                         02990000
  8160. /* ------------------------------------------------------------ KEEPFILE03000000
  8161.  *  Save the selected file on disk.                                     03010000
  8162.  */                                                                     03020000
  8163. KEEPFILE:                                                               03030000
  8164.                                                                         03040000
  8165. If fs.tube ^= "" Then Do                                                03050000
  8166.     'CALLPIPE COMMAND XMITMSG 508 (APPLID GOP CALLER CLI ERRMSG | *:'   03060000
  8167.     Return                                                              03070000
  8168.     End  /*  If  ..  Do  */                                             03080000
  8169.                                                                         03090000
  8170. Parse Var path 1 . 2 path    /*  discard type indicator  */             03100000
  8171. file = gopclifi(path)                                                   03110000
  8172. 'CALLPIPE CMS STATE' file 'A | VAR NOTFOUND'                            03120000
  8173. If rc ^= 0 & rc ^= 28 Then 'CALLPIPE VAR NOTFOUND | *:'                 03130000
  8174. If rc = 0 Then 'CALLPIPE COMMAND XMITMSG 594 FILE' ,                    03140000
  8175.         '(APPLID GOP CALLER CLI ERRMSG | *:'                            03150000
  8176. If rc ^= 28 Then Return                                                 03160000
  8177.                                                                         03170000
  8178. If filter = "" Then                                                     03180000
  8179. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                             03190000
  8180.         '| >' file 'A' ,                                                03200000
  8181.         '! E: |' stat                                                   03210000
  8182. Else                                                                    03220000
  8183. 'CALLPIPE (END !) VAR ITEM | E: GOPCLISX' ,                             03230000
  8184.         '|' filter '| >' file 'A' ,                                     03240000
  8185.         '! E: |' stat                                                   03250000
  8186.                                                                         03260000
  8187. If rc = 0 Then 'CALLPIPE COMMAND XMITMSG 571 FILE PATH' ,               03270000
  8188.         '(APPLID GOP CALLER CLI ERRMSG | *:'                            03280000
  8189. /*  If rc = 0 Then errmsg = "Created" fn ft fm "from" path  */          03290000
  8190.                                                                         03300000
  8191. Return                                                                  03310000
  8192.                                                                         03320000
  8193. :READ  GOPCLIST $REXX    A1 TMP200 01/25/93 15:25:37                            
  8194. /*                                                                      00010000
  8195.  *        Name: GOPCLIST REXX                                           00020000
  8196.  *              VM TCP/IP Network GOPHER Client transaction status      00030000
  8197.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  8198.  *        Date: 1993-Jan-12                                             00050000
  8199.  *                                                                      00060000
  8200.  *       Input: zero or more connection status messages                 00070000
  8201.  *      Output: -none-                                                  00080000
  8202.  */                                                                     00090000
  8203.                                                                         00100000
  8204. /*                                                                      00110000
  8205.  *      Copyright 1992 Richard M. Troth.   This software was developed  00120000
  8206.  *      with resources provided by Rice University and is intended      00130000
  8207.  *      to serve Rice's user community.   Rice has benefitted greatly   00140000
  8208.  *      from the free distribution of software,  therefore distribution 00150000
  8209.  *      of unmodified copies of this material is not restricted.        00160000
  8210.  *      You may change your own copy as needed.   Neither Rice          00170000
  8211.  *      University nor any of its employees or students shall be held   00180000
  8212.  *      liable for damages resulting from the use of this software.     00190000
  8213.  */                                                                     00200000
  8214.                                                                         00210000
  8215. Trace "OFF"                                                             00220000
  8216.                                                                         00230000
  8217. /*  sync with input  */                                                 00240000
  8218. 'PEEKTO'                                                                00250000
  8219. If rc ^= 0 Then Exit rc * (rc ^= 12)                                    00260000
  8220.                                                                         00270000
  8221. /*  abort if we're not in a 370 mode machine  */                        00280000
  8222. Parse Value Diag(08,'QUERY SET') With . "MACHINE" mach . ',' . '15'x .  00290000
  8223. If mach ^= "370" & mach ^= "" Then Do                                   00300000
  8224.     'CALLPIPE *: | HOLE'                                                00310000
  8225.     Exit rc                                                             00320000
  8226.     End  /*  If  ..  Do  */                                             00330000
  8227.                                                                         00340000
  8228. /*  fetch fs. stem variable from GlobalVs  */                           00350000
  8229. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER LIST | DROP' ,                  00360000
  8230.         '| LOCATE 1-4 / FS./ | SPEC /=/ 1 2-* NEXT | VARLOAD'           00370000
  8231. If ^Datatype(fs.tube,'X') Then fs.tube = ""                             00380000
  8232.                                                                         00390000
  8233. /*  prepare for dynamic connection statistics  */                       00400000
  8234. _wid = fs.scrcols - 2                                                   00410000
  8235. _sba = c2x(sba(1,-1) || '1D60'x)                                        00420000
  8236.                                                                         00430000
  8237. 'CALLPIPE *: | CHOP ' _wid '| PAD' _wid ,                               00440000
  8238.        '| SPEC /00C3' || _sba || '/ X2C 1 1-* NEXT' ,                   00450000
  8239.        '| FULLSCR' fs.tube 'NOREAD | HOLE'                              00460000
  8240.                                                                         00470000
  8241. Exit rc                                                                 00480000
  8242.                                                                         00490000
  8243.                                                                         00500000
  8244.                                                                         00510000
  8245. /* ----------------------------------------------------------------- SBA00520000
  8246.  *  (a better SBA function extracted from PIPEDEMO; thanks, Chuck!)     00530000
  8247.  *  Construct Set Buffer Address order from row and column.             00540000
  8248.  */                                                                     00550000
  8249.                                                                         00560000
  8250. SBA:      Procedure Expose fs.                                          00570000
  8251.                                                                         00580000
  8252. arg row , col, .                                                        00590000
  8253. row = Trunc(row)                                                        00600000
  8254. col = Trunc(col)                                                        00610000
  8255.                                                                         00620000
  8256. /*-----------------------------------------------------------------*/   00630000
  8257. /* Calculate binary address.                                       */   00640000
  8258. /*-----------------------------------------------------------------*/   00650000
  8259.                                                                         00660000
  8260. offset = row * fs.scrcols + col                                         00670000
  8261. Do While offset < 0; offset = offset + fs.scrrows * fs.scrcols; End     00680000
  8262.                                                                         00690000
  8263. if fs.14bit then return '11'x || d2c(offset,2)                          00700000
  8264.                                                                         00710000
  8265. /*-----------------------------------------------------------------*/   00720000
  8266. /* Convert to six-bit format. (xxxx111111111111 -> 0011111100111111*/   00730000
  8267. /*-----------------------------------------------------------------*/   00740000
  8268.                                                                         00750000
  8269. 'CALLPIPE var offset'               ,   /* Start with char number.    */00760000
  8270.     '| spec 1-* d2c 1.2 right'      ,   /* Convert to binary.         */00770000
  8271.     '| spec 1-* c2b 1'              ,   /* Convert to bit string.     */00780000
  8272.     '| spec /00/ 1  5.6  3'         ,   /* Place first six bits.      */00790000
  8273.            '/00/ 9 11.6 11'         ,   /* Place second six bits.     */00800000
  8274.     '| spec 1-* b2c 1'              ,   /* Convert back to binary.    */00810000
  8275.     '| xlate *-* 00-3F 40-7F'       ,   /* Translate to coded         */00820000
  8276.                 '01-09 C1-C9'       ,   /*   buffer address.          */00830000
  8277.                 '11-19 D1-D9'       ,   /*                            */00840000
  8278.                 '22-29 E2-E9'       ,   /*                            */00850000
  8279.                 '30-39 F0-F9'       ,   /*                            */00860000
  8280.     '| spec x11 1 1.2 2'            ,   /* Prefix with SBA order.     */00870000
  8281.     '| var offset'                      /* Put back in variable.      */00880000
  8282.                                                                         00890000
  8283. Return offset                                                           00900000
  8284.                                                                         00910000
  8285. :READ  GOPCLIMB $REXX    A1 TMP200 01/25/93 15:25:33                            
  8286. /*                                                                      00010000
  8287.  *        Name: GOPCLIMB REXX                                           00020000
  8288.  *              VM TCP/IP Network GOPHER Client menu browser            00030000
  8289.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  8290.  *        Date: 1992-Dec-23                                             00050000
  8291.  *                                                                      00060000
  8292.  *       Input: one or more gopher menu lines                           00070000
  8293.  *      Output: zero or more information or error messages              00080000
  8294.  */                                                                     00090000
  8295.                                                                         00100000
  8296. /*                                                                      00110000
  8297.  *      Copyright 1992 Richard M. Troth.   This software was developed  00120000
  8298.  *      with resources provided by Rice University and is intended      00130000
  8299.  *      to serve Rice's user community.   Rice has benefitted greatly   00140000
  8300.  *      from the free distribution of software,  therefore distribution 00150000
  8301.  *      of unmodified copies of this material is not restricted.        00160000
  8302.  *      You may change your own copy as needed.   Neither Rice          00170000
  8303.  *      University nor any of its employees or students shall be held   00180000
  8304.  *      liable for damages resulting from the use of this software.     00190000
  8305.  */                                                                     00200000
  8306.                                                                         00210000
  8307. Trace "OFF"                                                             00220000
  8308.                                                                         00230000
  8309. Parse Arg args '(' . ')' .                                              00240000
  8310.                                                                         00250000
  8311. /*  verify availability of input  */                                    00260000
  8312. 'PEEKTO'                                                                00270000
  8313. If rc ^= 0 & rc ^= 12 Then Exit rc                                      00280000
  8314. If rc = 12 Then Do  /*  empty menu  */                                  00290000
  8315.     'CALLPIPE COMMAND XMITMSG 60 (APPLID GOP CALLER CLI ERRMSG | *:'    00300000
  8316.     Exit                                                                00310000
  8317.     End  /*  If  ..  Do  */                                             00320000
  8318.                                                                         00330000
  8319. Address "COMMAND" 'GLOBALV SELECT GOPHER GET' ,                         00340000
  8320.         'GOPHER PROGID VIEWER ITEM'                                     00350000
  8321. quit = 0                                                                00360000
  8322.                                                                         00370000
  8323. Parse Var item name '05'x path '05'x host '05'x port '05'x xtra         00380000
  8324. Parse Var name 1 . 2 name       /*  discard type indicator byte  */     00390000
  8325. Parse Var path 1 . 2 path       /*  discard type indicator byte  */     00400000
  8326. If name = "" Then name = args                                           00410000
  8327. booklist = (item = "")                                                  00420000
  8328.                                                                         00430000
  8329. /*  fetch fs. stem variable from GlobalVs  */                           00440000
  8330. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER LIST | DROP' ,                  00450000
  8331.         '| LOCATE 1-4 / FS./ | SPEC /=/ 1 2-* NEXT | VARLOAD'           00460000
  8332. If ^Datatype(fs.tube,'X') Then fs.tube = ""                             00470000
  8333.                                                                         00480000
  8334. 'CALLPIPE *: | STEM MENU.'                                              00490000
  8335.                                                                         00500000
  8336. /* is it a server error? */                                             00510000
  8337. If menu.0 = 1 & Left(menu.1,1) = '-' Then Do                            00520000
  8338.     Parse Var menu.1 . '-' errmsg '05'x .                               00530000
  8339.     'OUTPUT' errmsg                                                     00540000
  8340.     Exit                                                                00550000
  8341.     End  /*  If  ..  Do  */                                             00560000
  8342.                                                                         00570000
  8343. /*  display the menu and process user's response  */                    00580000
  8344. row = 0;        col = 0         /*  reset later  */                     00590000
  8345. ki = menu.0;    kl = fs.scrrows - 5;    ko = 1                          00600000
  8346. needle = ""     /*  may be re-used within this context  */              00610000
  8347. message.0 = 0                                                           00620000
  8348. command = ""                                                            00630000
  8349.                                                                         00640000
  8350. If booklist Then 'CALLPIPE COMMAND XMITMSG 615' ,                       00650000
  8351.         '(APPLID GOP CALLER CLI NOCOMP | SPEC WORD 2-* 1 | STEM HELP.'  00660000
  8352.             Else 'CALLPIPE COMMAND XMITMSG 613' ,                       00670000
  8353.         '(APPLID GOP CALLER CLI NOCOMP | SPEC WORD 2-* 1 | STEM HELP.'  00680000
  8354.                                                                         00690000
  8355. 'CALLPIPE COMMAND XMITMSG 5 (APPLID GOP NOHEADER | VAR MORE'            00700000
  8356.                                                                         00710000
  8357. Do Forever                                                              00720000
  8358.                                                                         00730000
  8359.     /*  write the program title line  */                                00740000
  8360.     wscreen = sba(0,-1) || field("BLUE","PROT") || sba(0,0) || progid , 00750000
  8361.                         || sba(0,fs.scrcols-Length(host)-1) || host     00760000
  8362.                                                                         00770000
  8363.     /*  no SBA for status because it follows host immediately  */       00780000
  8364.     If message.0 < 1 Then Do                                            00790000
  8365.     wscreen = wscreen   || field("PROT") || Left(ko || '/' || ki, 11)   00800000
  8366.     If ko + kl <= ki Then                                               00810000
  8367.     wscreen = wscreen   || field("WHITE","HIGH","PROT") || more         00820000
  8368.         End  /*  If  ..  Do  */                                         00830000
  8369.                                                                         00840000
  8370.     /*  don't write status or name if they'll be overlaid  */           00850000
  8371.     If message.0 < 2 Then                                               00860000
  8372.     wscreen = wscreen   || sba(2,(fs.scrcols-Length(name))/2) ,         00870000
  8373.                         || field("WHITE","PROT") || name                00880000
  8374.                                                                         00890000
  8375.     /*  write as many message lines as needed  */                       00900000
  8376.     If message.0 > 0 Then Do                                            00910000
  8377.         Do i = 1 to message.0                                           00920000
  8378.             wscreen = wscreen || sba(i,-1) ,                            00930000
  8379.                 || field("RED","HIGH","PROT") || message.i              00940000
  8380.             End  /*  Do  For  */                                        00950000
  8381.         message.0 = 0                                                   00960000
  8382.         End  /*  If  ..  Do  */                                         00970000
  8383.     /*  we should probably limit that count  */                         00980000
  8384.                                                                         00990000
  8385.     /*  write those PFkey settings  */                                  01000000
  8386.     wscreen = wscreen   || sba(fs.scrrows-2,-1) ,                       01010000
  8387.                         || field("BLUE","PROT") ,                       01020000
  8388.                         || help.1 ,                                     01030000
  8389.                         || sba(fs.scrrows-1,-1) ,                       01040000
  8390.                         || field("BLUE","PROT") ,                       01050000
  8391.                         || help.2                                       01060000
  8392.                                                                         01070000
  8393.     i = 1; j = ko                                                       01080000
  8394.     Do While i <= kl & j <= ki                                          01090000
  8395.                                                                         01100000
  8396.         Parse Var menu.j _name '05'x .                                  01110000
  8397.         Parse Var _name 1 _type 2 _name                                 01120000
  8398.         'CALLPIPE VAR _NAME | XLATE OUTPUT' ,                           01130000
  8399.             '| XLATE *-* 00-3F 40 FF 40 | VAR _NAME'                    01140000
  8400.                                                                         01150000
  8401.         wscreen = wscreen || sba(i+2,-1) ,                              01160000
  8402.                           || field("BLUE","PROT","HIGH")                01170000
  8403.         If _type = 'i' Then                                             01180000
  8404.         wscreen = wscreen || Left(_name,fs.scrcols-1)                   01190000
  8405.                       Else Do                                           01200000
  8406.         wscreen = wscreen || Left(gtag(_type),11) ,                     01210000
  8407.                           || field("GREEN") ,                           01220000
  8408.                           || Left(_name,fs.scrcols-13)                  01230000
  8409.             If row = 0 Then Do                                          01240000
  8410.                 row = i + 2;    col = 12                                01250000
  8411.                 End  /*  If  ..  Do  */                                 01260000
  8412.             End  /*  Else  Do  */                                       01270000
  8413.                                                                         01280000
  8414.         i = i + 1;  j = j + 1                                           01290000
  8415.                                                                         01300000
  8416.         End  /*  Do  While  */                                          01310000
  8417.                                                                         01320000
  8418.     rscreen = write_read(wscreen || sba(row,col) || '13'x)              01330000
  8419.     Parse Var rscreen 1 aid 2 offset . '11'x rscreen                    01340000
  8420.     offset = fix(offset)                                                01350000
  8421.     row = offset % fs.scrcols; col = offset // fs.scrcols               01360000
  8422.                                                                         01370000
  8423.     /*  keep the row/col values within bounds  */                       01380000
  8424.     If  row      <   3       Then row = 3                               01390000
  8425.     If  row      >   kl + 3  Then row = kl + 3                          01400000
  8426.     If  row + ko >   ki + 3  Then row = ki + 3 - ko                     01410000
  8427.     col = 12    /*  just reset it  */                                   01420000
  8428.                                                                         01430000
  8429.     i = row + ko - 3                                                    01440000
  8430.                                                                         01450000
  8431.     Select /* aid */                                                    01460000
  8432.         When  aid = '7D'x   /* enter */ | ,                             01470000
  8433.               aid = 'F2'x   /*  PF2  */ | ,                             01480000
  8434.               aid = 'C2'x   /*  PF14 */ | ,                             01490000
  8435.               aid = '7B'x   /*  PF11 */ | ,                             01500000
  8436.               aid = '4B'x   /*  PF23 */ Then  Call  OPEN                01510000
  8437.         When  aid = 'F3'x   /*  PF3  */ | ,                             01520000
  8438.               aid = 'C3'x   /*  PF15 */ Then  Leave                     01530000
  8439.         When  aid = 'F4'x   /*  PF4  */ | ,                             01540000
  8440.               aid = 'C4'x   /*  PF16 */ Then  Call  PRINT               01550000
  8441.         When  aid = 'F5'x   /*  PF5  */ | ,                             01560000
  8442.               aid = 'C5'x   /*  PF17 */ Then  Call  KEEP                01570000
  8443.         When  aid = 'F6'x   /*  PF6  */ | ,                             01580000
  8444.               aid = 'C6'x   /*  PF18 */ Then  Call  FIND                01590000
  8445.         When  aid = 'F7'x   /*  PF7  */ | ,                             01600000
  8446.               aid = 'C7'x   /*  PF19 */ Then Do                         01610000
  8447.             ko = Max(ko-kl+1,1)                                         01620000
  8448.             row = 3                                                     01630000
  8449.             End  /*  When  ..  Do  */                                   01640000
  8450.         When  aid = 'F8'x   /*  PF8  */ | ,                             01650000
  8451.               aid = 'C8'x   /*  PF20 */ Then Do                         01660000
  8452.             ko = Min(ko+kl-1,ki)                                        01670000
  8453.             row = 3                                                     01680000
  8454.             End  /*  When  ..  Do  */                                   01690000
  8455.         When  aid = 'F9'x   /*  PF9  */ | ,                             01700000
  8456.               aid = 'C9'x   /*  PF21 */ Then  Call  MARK                01710000
  8457.         When  aid = '7A'x   /*  PF10 */ | ,                             01720000
  8458.               aid = '4A'x   /*  PF22 */ Then  Call  BOOKLIST            01730000
  8459.         When  aid = '6D'x   /* clear */ | ,                             01740000
  8460.               aid = '6E'x   /*  PA2  */ Then Do                         01750000
  8461.             row = 3;    col = 12;   ko = 1                              01760000
  8462.             End  /*  When ..  Do  */                                    01770000
  8463.         When  aid = '7C'x   /*  PF12 */ | ,                             01780000
  8464.               aid = '4C'x   /*  PF24 */ | ,                             01790000
  8465.               aid = 'F0'x   /* sysrq */ | ,                             01800000
  8466.               aid = '6C'x   /*  PA1  */ Then  quit = 1                  01810000
  8467.         When  aid = 'F1'x   /*  PF1  */ | ,                             01820000
  8468.               aid = 'C1'x   /*  PF13 */ Then  Call  HELP                01830000
  8469.         When  aid = '00'x               Then Do                         01840000
  8470.             /*  I/O error on screen  */                                 01850000
  8471.             'CALLPIPE COMMAND XMITMSG 925 (APPLID GOP' ,                01860000
  8472.                     'CALLER CLI ERRMSG | STEM MESSAGE. APPEND'          01870000
  8473.             Leave                                                       01880000
  8474.             End                                                         01890000
  8475.         Otherwise  Do   /*  Undefined PFkey/PAkey  */                   01900000
  8476.             'CALLPIPE COMMAND XMITMSG 657 "' || c2x(aid) || '"' ,       01910000
  8477.                 '(APPLID GOP CALLER CLI ERRMSG | STEM MESSAGE. APPEND'  01920000
  8478.             End  /*  Otherwise  Do  */                                  01930000
  8479.         End  /*  Select  aid  */                                        01940000
  8480.                                                                         01950000
  8481.     Address "COMMAND" 'GLOBALV SELECT GOPHER GET COMMAND'               01960000
  8482.     Parse Upper Var command cmdverb .                                   01970000
  8483.     quit = (quit | Abbrev("QUIT",cmdverb,1))                            01980000
  8484.                                                                         01990000
  8485.     If quit Then Leave                                                  02000000
  8486.                                                                         02010000
  8487.     End  /*  Do  Forever  */                                            02020000
  8488.                                                                         02030000
  8489. If quit Then command = "QUIT"                                           02040000
  8490.                                                                         02050000
  8491. 'CALLPIPE STEM MESSAGE. | *:'                                           02060000
  8492.                                                                         02070000
  8493. Parse Upper Var command cmdverb .                                       02080000
  8494. Address "COMMAND" 'GLOBALV SELECT GOPHER PUT' ,                         02090000
  8495.         'COMMAND CMDVERB'                                               02100000
  8496.                                                                         02110000
  8497. Exit                                                                    02120000
  8498.                                                                         02130000
  8499.                                                                         02140000
  8500.                                                                         02150000
  8501. /* ---------------------------------------------------------------- OPEN02160000
  8502.  */                                                                     02170000
  8503. OPEN:                                                                   02180000
  8504.                                                                         02190000
  8505. 'CALLPIPE VAR MENU.' || i '| GOPCLITM OPEN | STEM MESSAGE. APPEND'      02200000
  8506.                                                                         02210000
  8507. Return                                                                  02220000
  8508.                                                                         02230000
  8509.                                                                         02240000
  8510.                                                                         02250000
  8511. /* --------------------------------------------------------------- PRINT02260000
  8512.  * Print the current "menu" on the user's virtual printer.              02270000
  8513.  */                                                                     02280000
  8514. PRINT:                                                                  02290000
  8515.                                                                         02300000
  8516. If fs.tube ^= "" Then Do                                                02310000
  8517.     /*  "Can't PRINT from this terminal."  */                           02320000
  8518.     'CALLPIPE COMMAND XMITMSG 507 (APPLID GOP CALLER CLI ERRMSG' ,      02330000
  8519.             '| STEM MESSAGE. APPEND'                                    02340000
  8520.     Return                                                              02350000
  8521.     End /* If .. Do */                                                  02360000
  8522.                                                                         02370000
  8523. 'CALLPIPE STEM MENU. | XLATE *-* 05 7A' ,                               02380000
  8524.         '| PRINT (TITLE' name '| STEM MESSAGE. APPEND'                  02390000
  8525.                                                                         02400000
  8526. Return                                                                  02410000
  8527.                                                                         02420000
  8528.                                                                         02430000
  8529.                                                                         02440000
  8530. /* ---------------------------------------------------------------- KEEP02450000
  8531.  */                                                                     02460000
  8532. KEEP:                                                                   02470000
  8533.                                                                         02480000
  8534. 'CALLPIPE VAR MENU.' || i '| GOPCLITM KEEP | STEM MESSAGE. APPEND'      02490000
  8535.                                                                         02500000
  8536. Return                                                                  02510000
  8537.                                                                         02520000
  8538.                                                                         02530000
  8539.                                                                         02540000
  8540. /* ---------------------------------------------------------------- FIND02550000
  8541.  *  Find a particular string within the menu being viewed.              02560000
  8542.  *  Call GOPCLIUI for user input with prompt.                           02570000
  8543.  */                                                                     02580000
  8544. FIND:                                                                   02590000
  8545.                                                                         02600000
  8546. 'CALLPIPE COMMAND XMITMSG 602 "' || needle || '" (APPLID GOP' ,         02610000
  8547.         'CALLER CLI NOHEADER | GOPCLIUI | VAR NEEDLE'                   02620000
  8548. needle = Translate(Strip(needle))                                       02630000
  8549. If needle = "" Then Return                                              02640000
  8550.                                                                         02650000
  8551. Do i = ko + 1 to ki                                                     02660000
  8552.     If Index(Translate(menu.i),needle) > 0 Then Do                      02670000
  8553.         ko = i                                                          02680000
  8554.         Return                                                          02690000
  8555.         End  /*  If  ..  Do  */                                         02700000
  8556.     End  /*  Do  For  */                                                02710000
  8557.                                                                         02720000
  8558. /*  'CALLPIPE COMMAND XMITMSG 546 (ERRMSG'  CALLER DMS is OK  */        02730000
  8559. /*  "Target not found"  */                                              02740000
  8560. 'CALLPIPE COMMAND XMITMSG 546 (APPLID GOP CALLER CLI ERRMSG' ,          02750000
  8561.         '| STEM MESSAGE. APPEND'                                        02760000
  8562.                                                                         02770000
  8563. Return                                                                  02780000
  8564.                                                                         02790000
  8565.                                                                         02800000
  8566.                                                                         02810000
  8567. /* ---------------------------------------------------------------- MARK02820000
  8568.  *  Save a bookmark referencing this menu,                              02830000
  8569.  *  or  (if in "booklist" mode)  delete the bookmark at the cursor.     02840000
  8570.  */                                                                     02850000
  8571. MARK:                                                                   02860000
  8572.                                                                         02870000
  8573. If fs.tube ^= "" Then Do                                                02880000
  8574.     /*  "Can't set bookmarks from this screen."  */                     02890000
  8575.     'CALLPIPE COMMAND XMITMSG 43 (APPLID GOP CALLER CLI ERRMSG' ,       02900000
  8576.             '| STEM MESSAGE. APPEND'                                    02910000
  8577.     Return                                                              02920000
  8578.     End /* If .. Do */                                                  02930000
  8579.                                                                         02940000
  8580. If booklist Then Do                                                     02950000
  8581.     'CALLPIPE COMMAND XMITMSG 42 I (APPLID GOP NOHEADER' ,              02960000
  8582.         '| SPEC /i            / 1 1-* NEXT | VAR BOOKMARK.' || i        02970000
  8583.     If rc = 0 Then                                                      02980000
  8584.     Address "COMMAND" 'GLOBALV SELECT GOPHER PUTP BOOKMARK.' || i       02990000
  8585.     If rc = 0 Then 'CALLPIPE COMMAND XMITMSG 42 I' ,                    03000000
  8586.         '(APPLID GOP CALLER CLI ERRMSG | STEM MESSAGE. APPEND'          03010000
  8587.         /*  "Bookmark" i "deleted."  */                                 03020000
  8588.     Else 'CALLPIPE COMMAND XMITMSG 514 RC "GLOBALV"' ,                  03030000
  8589.         '(APPLID GOP CALLER CLI ERRMSG | STEM MESSAGE. APPEND'          03040000
  8590.     Return                                                              03050000
  8591.     End /* If .. Do */                                                  03060000
  8592.                                                                         03070000
  8593. Address "COMMAND" 'GLOBALV SELECT GOPHER GET BOOKMARK.0'                03080000
  8594. If ^Datatype(bookmark.0,'N') Then bookmark.0 = 0                        03090000
  8595. i = bookmark.0 + 1                                                      03100000
  8596. bookmark.i = item                                                       03110000
  8597. Address "COMMAND" 'GLOBALV SELECT GOPHER PUTP BOOKMARK.' || i           03120000
  8598. bookmark.0 = i                                                          03130000
  8599. Address "COMMAND" 'GLOBALV SELECT GOPHER PUTP BOOKMARK.0'               03140000
  8600.                                                                         03150000
  8601. If rc = 0 Then 'CALLPIPE COMMAND XMITMSG 41 I' ,                        03160000
  8602.     '(APPLID GOP CALLER CLI ERRMSG | STEM MESSAGE. APPEND'              03170000
  8603.     /*  "Bookmark" i "saved."  */                                       03180000
  8604.           Else 'CALLPIPE COMMAND XMITMSG 514 RC "GLOBALV"' ,            03190000
  8605.         '(APPLID GOP CALLER CLI ERRMSG | STEM MESSAGE. APPEND'          03200000
  8606.                                                                         03210000
  8607. Return                                                                  03220000
  8608.                                                                         03230000
  8609.                                                                         03240000
  8610.                                                                         03250000
  8611. /* ------------------------------------------------------------ BOOKLIST03260000
  8612.  *  Call GOPCLI to show the lit of bookmarks.                           03270000
  8613.  */                                                                     03280000
  8614. BOOKLIST:                                                               03290000
  8615.                                                                         03300000
  8616. Address "CMS" 'GOPCLI (BOOKLIST'                                        03310000
  8617.                                                                         03320000
  8618. Return                                                                  03330000
  8619.                                                                         03340000
  8620.                                                                         03350000
  8621.                                                                         03360000
  8622. /* ----------------------------------------------------------------- FIX03370000
  8623.  * Takes an inbound 3270 DS screen address (two bytes)                  03380000
  8624.  * and returns the equivalent byte offset in decimal.                   03390000
  8625.  */                                                                     03400000
  8626. FIX:                                                                    03410000
  8627. Parse Arg o,.                                                           03420000
  8628. Parse Var o 1 o1 2 o2 3 .                                               03430000
  8629. o1 = c2d(o1)                                                            03440000
  8630. o2 = c2d(o2)                                                            03450000
  8631. If o1 < 64 Then Return o1 * 256 + o2                                    03460000
  8632.            Else Return (o1 // 64) * 64 + (o2 // 64)                     03470000
  8633.                                                                         03480000
  8634.                                                                         03490000
  8635.                                                                         03500000
  8636. /* ---------------------------------------------------------- WRITE_READ03510000
  8637.  * Display what we have, then wait for user input and return it.        03520000
  8638.  */                                                                     03530000
  8639. WRITE_READ: Procedure Expose fs.                                        03540000
  8640. Parse Arg ws,wcc,wrt,.                                                  03550000
  8641. If wcc = "" Then wcc = 'C3'x                                            03560000
  8642. /*  If wrt = "" Then wrt = 'C0'x  */                                    03570000
  8643. If wrt = "" Then wrt = fs.write                                         03580000
  8644. ws = wrt || wcc || ws                                                   03590000
  8645. 'CALLPIPE VAR WS | FULLSCR' fs.tube '| VAR RS'                          03600000
  8646. If rc ^= 0 Then rs = '000000'x                                          03610000
  8647. Return rs                                                               03620000
  8648.                                                                         03630000
  8649.                                                                         03640000
  8650.                                                                         03650000
  8651. /* ----------------------------------------------------------------- SBA03660000
  8652.  * (a better SBA function extracted from PIPEDEMO; thanks, Chuck!)      03670000
  8653.  * Construct Set Buffer Address order from row and column.              03680000
  8654.  */                                                                     03690000
  8655.                                                                         03700000
  8656. SBA:      Procedure Expose fs.                                          03710000
  8657.                                                                         03720000
  8658. arg row , col, .                                                        03730000
  8659. row = Trunc(row)                                                        03740000
  8660. col = Trunc(col)                                                        03750000
  8661.                                                                         03760000
  8662. /*-----------------------------------------------------------------*/   03770000
  8663. /* Calculate binary address.                                       */   03780000
  8664. /*-----------------------------------------------------------------*/   03790000
  8665.                                                                         03800000
  8666. offset = row * fs.scrcols + col                                         03810000
  8667. Do While offset < 0; offset = offset + fs.scrrows * fs.scrcols; End     03820000
  8668.                                                                         03830000
  8669. if fs.14bit then return '11'x || d2c(offset,2)                          03840000
  8670.                                                                         03850000
  8671. /*-----------------------------------------------------------------*/   03860000
  8672. /* Convert to six-bit format. (xxxx111111111111 -> 0011111100111111*/   03870000
  8673. /*-----------------------------------------------------------------*/   03880000
  8674.                                                                         03890000
  8675. 'CALLPIPE var offset'               ,   /* Start with char number.    */03900000
  8676.     '| spec 1-* d2c 1.2 right'      ,   /* Convert to binary.         */03910000
  8677.     '| spec 1-* c2b 1'              ,   /* Convert to bit string.     */03920000
  8678.     '| spec /00/ 1  5.6  3'         ,   /* Place first six bits.      */03930000
  8679.            '/00/ 9 11.6 11'         ,   /* Place second six bits.     */03940000
  8680.     '| spec 1-* b2c 1'              ,   /* Convert back to binary.    */03950000
  8681.     '| xlate *-* 00-3F 40-7F'       ,   /* Translate to coded         */03960000
  8682.                 '01-09 C1-C9'       ,   /*   buffer address.          */03970000
  8683.                 '11-19 D1-D9'       ,   /*                            */03980000
  8684.                 '22-29 E2-E9'       ,   /*                            */03990000
  8685.                 '30-39 F0-F9'       ,   /*                            */04000000
  8686.     '| spec x11 1 1.2 2'            ,   /* Prefix with SBA order.     */04010000
  8687.     '| var offset'                      /* Put back in variable.      */04020000
  8688.                                                                         04030000
  8689. Return offset                                                           04040000
  8690.                                                                         04050000
  8691.                                                                         04060000
  8692.                                                                         04070000
  8693. /* --------------------------------------------------------------- FIELD04080000
  8694.  * Generate the 3270 DS sequence for extended field attributes          04090000
  8695.  * (if available).                                                      04100000
  8696.  */                                                                     04110000
  8697. FIELD:    Procedure Expose fs.                                          04120000
  8698. a = '00'x                                                               04130000
  8699. b = '00'x                                                               04140000
  8700. c = 'F1'x                                                               04150000
  8701. i = 1                                                                   04160000
  8702. Do While Arg(i) ^= ""                                                   04170000
  8703.     Select  /*  at  */                                                  04180000
  8704.         When Abbrev("PROTECTED",Arg(i),2)   Then a = bitor(a,'20'x)     04190000
  8705.         When Abbrev("SKIP",Arg(i),1)        Then a = bitor(a,'10'x)     04200000
  8706.         When Abbrev("NODISPLAY",Arg(i),1)   Then a = bitor(a,'0C'x)     04210000
  8707.         When Abbrev("HIGH",Arg(i),1)        Then a = bitor(a,'08'x)     04220000
  8708.         When Abbrev("BLINK",Arg(i),3)       Then b = bitor(b,'01'x)     04230000
  8709.         When Abbrev("REVERSE",Arg(i),3)     Then b = bitor(b,'02'x)     04240000
  8710.         When Abbrev("UNDERLINE",Arg(i),1)   Then b = bitor(b,'04'x)     04250000
  8711.         When Abbrev("BLUE",Arg(i),3)        Then c = 'F1'x              04260000
  8712.         When Abbrev("RED",Arg(i),3)         Then c = 'F2'x              04270000
  8713.         When Abbrev("PINK",Arg(i),1)        Then c = 'F3'x              04280000
  8714.         When Abbrev("GREEN",Arg(i),1)       Then c = 'F4'x              04290000
  8715.         When Abbrev("TURQUOISE",Arg(i),1)   Then c = 'F5'x              04300000
  8716.         When Abbrev("YELLOW",Arg(i),1)      Then c = 'F6'x              04310000
  8717.         When Abbrev("WHITE",Arg(i),1)       Then c = 'F7'x              04320000
  8718.         Otherwise nop                                                   04330000
  8719.         End  /*  Select  at  */                                         04340000
  8720.     i = i + 1                                                           04350000
  8721.     End  /*  Do  While  */                                              04360000
  8722.                                                                         04370000
  8723. If  ^fs.color   | ,                                                     04380000
  8724.     ^fs.exthi   Then    Return '1D'x || bitor(a,'40'x)                  04390000
  8725.                 Else    Return '2902'x || ,                             04400000
  8726.                                'C0'x   || bitor(a,'40'x) || ,           04410000
  8727.                                '42'x   || bitor(c,'40'x)                04420000
  8728.                                                                         04430000
  8729.                                                                         04440000
  8730.                                                                         04450000
  8731. /* ---------------------------------------------------------------- GTAG04460000
  8732.  *  Match the gopher data type to a national language  "tag"  string.   04470000
  8733.  */                                                                     04480000
  8734. GTAG:     Procedure                                                     04490000
  8735.                                                                         04500000
  8736. Parse Arg type                                                          04510000
  8737.                                                                         04520000
  8738.     Select  /*  type  */                                                04530000
  8739.                                                                         04540000
  8740.         When type = '0' Then _tag = 700                                 04550000
  8741.         When type = '1' Then _tag = 701                                 04560000
  8742.         When type = '2' Then _tag = 702                                 04570000
  8743.         When type = '3' Then _tag = 703                                 04580000
  8744.         When type = '4' Then _tag = 704                                 04590000
  8745.         When type = '5' Then _tag = 705                                 04600000
  8746.         When type = '6' Then _tag = 706                                 04610000
  8747.         When type = '7' Then _tag = 707                                 04620000
  8748.         When type = '8' Then _tag = 708                                 04630000
  8749.         When type = '9' Then _tag = 709                                 04640000
  8750.         When type = 's' Then _tag = 767                                 04650000
  8751.         When type = 'r' Then _tag = 766                                 04660000
  8752.         When type = 'v' Then _tag = 770                                 04670000
  8753.         When type = 'i' Then _tag = 757                                 04680000
  8754.         When type = 'I' Then _tag = 725                                 04690000
  8755.         When type = 'g' Then _tag = 755                                 04700000
  8756.         When type = 'M' Then _tag = 729                                 04710000
  8757.         When type = 'T' Then _tag = 736                                 04720000
  8758.                                                                         04730000
  8759.         When type = ':' Then _tag = 710                                 04740000
  8760.         When type = ';' Then _tag = 711                                 04750000
  8761.         When type = '<' Then _tag = 712                                 04760000
  8762.                                                                         04770000
  8763.         Otherwise            _tag = 908                                 04780000
  8764.                                                                         04790000
  8765.         End  /*  Select  type  */                                       04800000
  8766.                                                                         04810000
  8767. 'CALLPIPE COMMAND XMITMSG' _tag 'TYPE (APPLID GOP NOHEADER | VAR TAG'   04820000
  8768.                                                                         04830000
  8769. Return tag                                                              04840000
  8770.                                                                         04850000
  8771.                                                                         04860000
  8772.                                                                         04870000
  8773. /* ---------------------------------------------------------------- HELP04880000
  8774.  *  Invoke CMS HELP for GOPHER BROWSER (the menu browser).              04890000
  8775.  */                                                                     04900000
  8776. HELP:     Procedure Expose fs. message.                                 04910000
  8777.                                                                         04920000
  8778. If fs.tube ^= "" Then                                                   04930000
  8779.     'CALLPIPE COMMAND HELP GOPHER BROWSER (ALL NOSCREEN' ,              04940000
  8780.         '| GOPCLIFV BROWSER HELP' ,                                     04950000
  8781.             '| STEM MESSAGE. APPEND'                                    04960000
  8782.                                                                         04970000
  8783. Else Do                                                                 04980000
  8784.     Address "COMMAND" 'HELP GOPHER BROWSER'                             04990000
  8785.     Address "COMMAND" 'VMFCLEAR'                                        05000000
  8786.     End  /*  Else  Do  */                                               05010000
  8787.                                                                         05020000
  8788. Return                                                                  05030000
  8789.                                                                         05040000
  8790. :READ  GOPCLIUI $REXX    A1 TMP200 01/25/93 15:25:29                            
  8791. /*                                                                      00010000
  8792.  *        Name: GOPCLIUI REXX                                           00020000
  8793.  *              VM TCP/IP Network GOPHER Client user input              00030000
  8794.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  8795.  *        Date: 1992-Dec-23                                             00050000
  8796.  *                                                                      00060000
  8797.  *       Input: a prompt string                                         00070000
  8798.  *      Output: the user's response                                     00080000
  8799.  *                                                                      00090000
  8800.  *              Untested with multiples,  but should work that way.     00100000
  8801.  */                                                                     00110000
  8802.                                                                         00120000
  8803. /*                                                                      00130000
  8804.  *      Copyright 1992 Richard M. Troth.   This software was developed  00140000
  8805.  *      with resources provided by Rice University and is intended      00150000
  8806.  *      to serve Rice's user community.   Rice has benefitted greatly   00160000
  8807.  *      from the free distribution of software,  therefore distribution 00170000
  8808.  *      of unmodified copies of this material is not restricted.        00180000
  8809.  *      You may change your own copy as needed.   Neither Rice          00190000
  8810.  *      University nor any of its employees or students shall be held   00200000
  8811.  *      liable for damages resulting from the use of this software.     00210000
  8812.  */                                                                     00220000
  8813.                                                                         00230000
  8814. Trace "OFF"                                                             00240000
  8815.                                                                         00250000
  8816. /*  fetch fs. stem variable from calling REXX environment  */           00260000
  8817. 'CALLPIPE REXXVARS 1 | DROP | JOIN 1 /,/' ,                             00270000
  8818.         '| CHANGE /n /,/ | CHANGE /,v /,/ 1 | LOCATE /FS./ | VARLOAD'   00280000
  8819.                                                                         00290000
  8820. /*  trouble with plain write,  so fetch current screen contents  */     00300000
  8821. 'CALLPIPE LITERAL 00 | SPEC 1-2 X2C 1' ,                                00310000
  8822.         '| FULLSCR' fs.tube 'CONDREAD | VAR SCREEN'                     00320000
  8823. Parse Var screen 1 aid 2 cursor 4 screen                                00330000
  8824.                                                                         00340000
  8825. Do Forever                                                              00350000
  8826.                                                                         00360000
  8827.     'PEEKTO PROMPT'                                                     00370000
  8828.     If rc ^= 0 Then Leave                                               00380000
  8829.                                                                         00390000
  8830.     Parse Var prompt prompt ';' preset                                  00400000
  8831.     prompt = Strip(prompt)                                              00410000
  8832.     preset = Strip(preset)                                              00420000
  8833.                                                                         00430000
  8834.     /* --------------------------------------------------------- GPROMPT00440000
  8835.      *  Present a prompt and read from the Gopher user's screen.        00450000
  8836.      *  Preset response data may have been supplied.                    00460000
  8837.      */                                                                 00470000
  8838.                                                                         00480000
  8839.     prompt = fs.write || 'C3'x || screen || ,                           00490000
  8840.             sba(1,-1) || field("PROT","GREEN") || prompt ,              00500000
  8841.             || field("HIGH","WHITE") || '13'x || preset || ,            00510000
  8842.             Copies('00'x,fs.scrcols*2-Length(prompt)-Length(preset)-4) ,00520000
  8843.             || field("PROT")                                            00530000
  8844.                                                                         00540000
  8845.     'CALLPIPE VAR PROMPT | FULLSCR' fs.tube '| VAR RS'                  00550000
  8846.     Parse Var rs With 1 aid 2 . 4 rs                                    00560000
  8847.                                                                         00570000
  8848.     If  aid = '7D'x   /* enter */   Then Do                             00580000
  8849.         Parse Var rs With . '11'x rs                                    00590000
  8850.         rs = Substr(rs,3)                                               00600000
  8851.         If rs = "" Then rs = preset                                     00610000
  8852.         'OUTPUT' rs                                                     00620000
  8853.         End  /*  If  ..  Do  */                                         00630000
  8854.                                                                         00640000
  8855.     Else 'OUTPUT'                                                       00650000
  8856.                                                                         00660000
  8857.     'CALLPIPE VAR CURSOR | SPEC /00C311/ X2C 1 1.2 NEXT' ,              00670000
  8858.             '/13/ X2C NEXT | FULLSCR' fs.tube 'NOREAD | HOLE'           00680000
  8859.                                                                         00690000
  8860.     'READTO'                                                            00700000
  8861.                                                                         00710000
  8862.     End  /*  Do  Forever  */                                            00720000
  8863.                                                                         00730000
  8864. Exit rc * (rc ^= 12)                                                    00740000
  8865.                                                                         00750000
  8866.                                                                         00760000
  8867.                                                                         00770000
  8868.                                                                         00780000
  8869. /* ----------------------------------------------------------------- SBA00790000
  8870.  * (a better SBA function extracted from PIPEDEMO; thanks, Chuck!)      00800000
  8871.  * Construct Set Buffer Address order from row and column.              00810000
  8872.  */                                                                     00820000
  8873.                                                                         00830000
  8874. SBA:      Procedure Expose fs.                                          00840000
  8875.                                                                         00850000
  8876. arg row , col, .                                                        00860000
  8877. row = Trunc(row)                                                        00870000
  8878. col = Trunc(col)                                                        00880000
  8879.                                                                         00890000
  8880. /*-----------------------------------------------------------------*/   00900000
  8881. /* Calculate binary address.                                       */   00910000
  8882. /*-----------------------------------------------------------------*/   00920000
  8883.                                                                         00930000
  8884. offset = row * fs.scrcols + col                                         00940000
  8885. Do While offset < 0; offset = offset + fs.scrrows * fs.scrcols; End     00950000
  8886.                                                                         00960000
  8887. if fs.14bit then return '11'x || d2c(offset,2)                          00970000
  8888.                                                                         00980000
  8889. /*-----------------------------------------------------------------*/   00990000
  8890. /* Convert to six-bit format. (xxxx111111111111 -> 0011111100111111*/   01000000
  8891. /*-----------------------------------------------------------------*/   01010000
  8892.                                                                         01020000
  8893. 'CALLPIPE var offset'               ,   /* Start with char number.    */01030000
  8894.     '| spec 1-* d2c 1.2 right'      ,   /* Convert to binary.         */01040000
  8895.     '| spec 1-* c2b 1'              ,   /* Convert to bit string.     */01050000
  8896.     '| spec /00/ 1  5.6  3'         ,   /* Place first six bits.      */01060000
  8897.            '/00/ 9 11.6 11'         ,   /* Place second six bits.     */01070000
  8898.     '| spec 1-* b2c 1'              ,   /* Convert back to binary.    */01080000
  8899.     '| xlate *-* 00-3F 40-7F'       ,   /* Translate to coded         */01090000
  8900.                 '01-09 C1-C9'       ,   /*   buffer address.          */01100000
  8901.                 '11-19 D1-D9'       ,   /*                            */01110000
  8902.                 '22-29 E2-E9'       ,   /*                            */01120000
  8903.                 '30-39 F0-F9'       ,   /*                            */01130000
  8904.     '| spec x11 1 1.2 2'            ,   /* Prefix with SBA order.     */01140000
  8905.     '| var offset'                      /* Put back in variable.      */01150000
  8906.                                                                         01160000
  8907. Return offset                                                           01170000
  8908.                                                                         01180000
  8909.                                                                         01190000
  8910.                                                                         01200000
  8911. /* --------------------------------------------------------------- FIELD01210000
  8912.  * Generate the 3270 DS sequence for extended field attributes          01220000
  8913.  * (if available).                                                      01230000
  8914.  */                                                                     01240000
  8915. FIELD:    Procedure Expose fs.                                          01250000
  8916. a = '00'x                                                               01260000
  8917. b = '00'x                                                               01270000
  8918. c = 'F1'x                                                               01280000
  8919. i = 1                                                                   01290000
  8920. Do While Arg(i) ^= ""                                                   01300000
  8921.     Select  /*  at  */                                                  01310000
  8922.         When Abbrev("PROTECTED",Arg(i),2)   Then a = bitor(a,'20'x)     01320000
  8923.         When Abbrev("SKIP",Arg(i),1)        Then a = bitor(a,'10'x)     01330000
  8924.         When Abbrev("NODISPLAY",Arg(i),1)   Then a = bitor(a,'0C'x)     01340000
  8925.         When Abbrev("HIGH",Arg(i),1)        Then a = bitor(a,'08'x)     01350000
  8926.         When Abbrev("BLINK",Arg(i),3)       Then b = bitor(b,'01'x)     01360000
  8927.         When Abbrev("REVERSE",Arg(i),3)     Then b = bitor(b,'02'x)     01370000
  8928.         When Abbrev("UNDERLINE",Arg(i),1)   Then b = bitor(b,'04'x)     01380000
  8929.         When Abbrev("BLUE",Arg(i),3)        Then c = 'F1'x              01390000
  8930.         When Abbrev("RED",Arg(i),3)         Then c = 'F2'x              01400000
  8931.         When Abbrev("PINK",Arg(i),1)        Then c = 'F3'x              01410000
  8932.         When Abbrev("GREEN",Arg(i),1)       Then c = 'F4'x              01420000
  8933.         When Abbrev("TURQUOISE",Arg(i),1)   Then c = 'F5'x              01430000
  8934.         When Abbrev("YELLOW",Arg(i),1)      Then c = 'F6'x              01440000
  8935.         When Abbrev("WHITE",Arg(i),1)       Then c = 'F7'x              01450000
  8936.         Otherwise nop                                                   01460000
  8937.         End  /*  Select  at  */                                         01470000
  8938.     i = i + 1                                                           01480000
  8939.     End  /*  Do  While  */                                              01490000
  8940.                                                                         01500000
  8941. If  ^fs.color   | ,                                                     01510000
  8942.     ^fs.exthi   Then    Return '1D'x || bitor(a,'40'x)                  01520000
  8943.                 Else    Return '2902'x || ,                             01530000
  8944.                                'C0'x   || bitor(a,'40'x) || ,           01540000
  8945.                                '42'x   || bitor(c,'40'x)                01550000
  8946.                                                                         01560000
  8947. :READ  GOPCLITX $REXX    A1 TMP200 01/25/93 15:25:26                            
  8948. /*                                                                      00010000
  8949.  *        Name: GOPCLITX REXX                                           00020000
  8950.  *              VM TCP/IP Network GOPHER Client plain-text processor    00030000
  8951.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  8952.  *        Date: 1992-Dec-23                                             00050000
  8953.  *                                                                      00060000
  8954.  *       Input: raw ASCII text                                          00070000
  8955.  *      Output: plain (EBCDIC) text                                     00080000
  8956.  */                                                                     00090000
  8957.                                                                         00100000
  8958. /*                                                                      00110000
  8959.  *      Copyright 1992 Richard M. Troth.   This software was developed  00120000
  8960.  *      with resources provided by Rice University and is intended      00130000
  8961.  *      to serve Rice's user community.   Rice has benefitted greatly   00140000
  8962.  *      from the free distribution of software,  therefore distribution 00150000
  8963.  *      of unmodified copies of this material is not restricted.        00160000
  8964.  *      You may change your own copy as needed.   Neither Rice          00170000
  8965.  *      University nor any of its employees or students shall be held   00180000
  8966.  *      liable for damages resulting from the use of this software.     00190000
  8967.  */                                                                     00200000
  8968.                                                                         00210000
  8969. /*  Trace "OFF"  */                                                     00220000
  8970.                                                                         00230000
  8971. /*  sync with input so that 'CALLPIPE COMMAND' will work  */            00240000
  8972. 'PEEKTO'                                                                00250000
  8973.                                                                         00260000
  8974. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER GET GOPHER'                     00270000
  8975. If gopher = "" Then gopher = "Gopher"                                   00280000
  8976.                                                                         00290000
  8977. 'ADDPIPE *: | DEBLOCK LINEND 0A | DROP LAST 1' ,                        00300000
  8978.         '| CHANGE' '000D002000'x '| TCPA2E' gopher '| *.INPUT:'         00310000
  8979.                                                                         00320000
  8980. /*                                                                      00330000
  8981.  *        Name: DROPDOTS REXX                                           00340000
  8982.  *              drop trailing lines consisting of only "."              00350000
  8983.  *              (typically used for end-of-file indication)             00360000
  8984.  *        Date: 1992-Apr-18, 20                                         00370000
  8985.  */                                                                     00380000
  8986.                                                                         00390000
  8987. dots = 0                                                                00400000
  8988. 'READTO LINE'                                                           00410000
  8989. Do While rc = 0                                                         00420000
  8990.     If Left(line,1) = "." Then Do                                       00430000
  8991.         dots = dots + 1                                                 00440000
  8992.         line.dots = line                                                00450000
  8993.         End  /*  If  ..  Do  */                                         00460000
  8994.     Else Do                                                             00470000
  8995.         Do i = 1 to dots;  'OUTPUT' line.i;  End                        00480000
  8996.         dots = 0                                                        00490000
  8997.         'OUTPUT' line                                                   00500000
  8998.         End  /*  Else  Do  */                                           00510000
  8999.     'READTO LINE'                                                       00520000
  9000.     End  /*  Do  While  */                                              00530000
  9001.                                                                         00540000
  9002. Exit                                                                    00550000
  9003.                                                                         00560000
  9004. :READ  GOPCLIFV $REXX    A1 TMP200 01/25/93 15:25:22                            
  9005. /*                                                                      00010000
  9006.  *        Name: GOPCLIFV REXX                                           00020000
  9007.  *              VM TCP/IP Network GOPHER Client file viewer             00030000
  9008.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  9009.  *        Date: 1992-Dec-23                                             00050000
  9010.  *                                                                      00060000
  9011.  *       Input: a plain-text file to view                               00070000
  9012.  *      Output: zero or more information or error messages              00080000
  9013.  */                                                                     00090000
  9014.                                                                         00100000
  9015. /*                                                                      00110000
  9016.  *      Copyright 1992 Richard M. Troth.   This software was developed  00120000
  9017.  *      with resources provided by Rice University and is intended      00130000
  9018.  *      to serve Rice's user community.   Rice has benefitted greatly   00140000
  9019.  *      from the free distribution of software,  therefore distribution 00150000
  9020.  *      of unmodified copies of this material is not restricted.        00160000
  9021.  *      You may change your own copy as needed.   Neither Rice          00170000
  9022.  *      University nor any of its employees or students shall be held   00180000
  9023.  *      liable for damages resulting from the use of this software.     00190000
  9024.  */                                                                     00200000
  9025.                                                                         00210000
  9026. Trace "OFF"                                                             00220000
  9027.                                                                         00230000
  9028. Parse Arg args '(' . ')' .                                              00240000
  9029.                                                                         00250000
  9030. /*  verify availability of input  */                                    00260000
  9031. 'PEEKTO'                                                                00270000
  9032. If rc ^= 0 & rc ^= 12 Then Exit rc                                      00280000
  9033. If rc = 12 Then Do  /*  Warning: file is empty  */                      00290000
  9034.     'CALLPIPE COMMAND XMITMSG 559 (ERRMSG | *:'                         00300000
  9035.     Exit                                                                00310000
  9036.     End  /*  If  ..  Do  */                                             00320000
  9037.                                                                         00330000
  9038. Address "COMMAND" 'GLOBALV SELECT GOPHER GET' ,                         00340000
  9039.         'GOPHER PROGID VIEWER ITEM'                                     00350000
  9040. quit = 0                                                                00360000
  9041.                                                                         00370000
  9042. Parse Var item name '05'x path '05'x host '05'x port '05'x xtra         00380000
  9043. Parse Var name 1 . 2 name       /*  discard type indicator byte  */     00390000
  9044. Parse Var path 1 . 2 path       /*  discard type indicarot byte  */     00400000
  9045. If name = "" Then name = args                                           00410000
  9046.                                                                         00420000
  9047. /*  fetch fs. stem variable from GlobalVs  */                           00430000
  9048. 'CALLPIPE COMMAND GLOBALV SELECT GOPHER LIST | DROP' ,                  00440000
  9049.         '| LOCATE 1-4 / FS./ | SPEC /=/ 1 2-* NEXT | VARLOAD'           00450000
  9050. If rc ^= 0 Then Address "COMMAND" 'EXEC GOPCLINI'                       00460000
  9051. If ^Datatype(fs.tube,'X') Then fs.tube = ""                             00470000
  9052.                                                                         00480000
  9053. message.0 = 0                                                           00490000
  9054. command = ""                                                            00500000
  9055.                                                                         00510000
  9056. Select  /*  viewer  */                                                  00520000
  9057.     When viewer = ""         Then Call BUILT_IN                         00530000
  9058.     When viewer = "XEDIT"    Then Call XEDIT                            00540000
  9059.     When viewer = "BROWSE"   Then Call BROWSE                           00550000
  9060.     Otherwise                     Call ANYOTHER                         00560000
  9061.     /*                                                                  00570000
  9062.         handle disk-full conditions!                                    00580000
  9063.      */                                                                 00590000
  9064.     End  /*  Select  viewer  */                                         00600000
  9065. vrc = rc                                                                00610000
  9066.                                                                         00620000
  9067. 'CALLPIPE STEM MESSAGE. | *:'                                           00630000
  9068.                                                                         00640000
  9069. Parse Upper Var command cmdverb .                                       00650000
  9070. Address "COMMAND" 'GLOBALV SELECT GOPHER PUT' ,                         00660000
  9071.         'COMMAND CMDVERB'                                               00670000
  9072.                                                                         00680000
  9073. Exit vrc                                                                00690000
  9074.                                                                         00700000
  9075.                                                                         00710000
  9076. /* ============================================================ BUILT_IN00720000
  9077.  */                                                                     00730000
  9078. BUILT_IN:                                                               00740000
  9079.                                                                         00750000
  9080. /*  read the file from the preceding stage  */                          00760000
  9081. 'CALLPIPE *: | EXPAND | XLATE OUTPUT | XLATE *-* 00-3F 40 FF 40' ,      00770000
  9082.         '| DEBLOCK FIXED' fs.scrcols + 1 '| STEM FILE.'                 00780000
  9083.                                                                         00790000
  9084. /*  display the file and process user's response  */                    00800000
  9085. row = 3;        col = 0                                                 00810000
  9086. ki = file.0;    kl = fs.scrrows - 5;    ko = 1                          00820000
  9087. needle = ""     /*  may be re-used within this context  */              00830000
  9088.                                                                         00840000
  9089. 'CALLPIPE COMMAND XMITMSG 614 (APPLID GOP' ,                            00850000
  9090.         'NOCOMP NOHEADER | STEM HELP.'                                  00860000
  9091.                                                                         00870000
  9092. 'CALLPIPE COMMAND XMITMSG 5 (APPLID GOP NOHEADER | VAR MORE'            00880000
  9093.                                                                         00890000
  9094. Do Forever                                                              00900000
  9095.                                                                         00910000
  9096.     /*  write the program title line  */                                00920000
  9097.     wscreen = sba(0,-1) || field("BLUE","PROT") || sba(0,0) || progid , 00930000
  9098.                         || sba(0,fs.scrcols-Length(host)-1) || host     00940000
  9099.                                                                         00950000
  9100.     /*  no SBA for status because it follows host immediately  */       00960000
  9101.     If message.0 < 1 Then Do                                            00970000
  9102.     wscreen = wscreen   || field("PROT") || Left(ko || '/' || ki, 11)   00980000
  9103.     If ko + kl <= ki Then                                               00990000
  9104.     wscreen = wscreen   || field("WHITE","HIGH","PROT") || more         01000000
  9105.         End  /*  If  ..  Do  */                                         01010000
  9106.                                                                         01020000
  9107.     /*  don't write status or name if they'll be overlaid  */           01030000
  9108.     If message.0 < 2 Then                                               01040000
  9109.     wscreen = wscreen   || sba(2,(fs.scrcols-Length(name))/2) ,         01050000
  9110.                         || field("WHITE","PROT") || name                01060000
  9111.                                                                         01070000
  9112.     /*  write as many message lines as needed  */                       01080000
  9113.     If message.0 > 0 Then Do                                            01090000
  9114.         Do i = 1 to message.0                                           01100000
  9115.             wscreen = wscreen || sba(i,-1) ,                            01110000
  9116.                 || field("RED","HIGH","PROT") || message.i              01120000
  9117.             End  /*  Do  For  */                                        01130000
  9118.         message.0 = 0                                                   01140000
  9119.         End  /*  If  ..  Do  */                                         01150000
  9120.     /*  we should probably limit that count  */                         01160000
  9121.                                                                         01170000
  9122.     /*  write those PFkey settings  */                                  01180000
  9123.     wscreen = wscreen   || sba(fs.scrrows-2,-1) ,                       01190000
  9124.                         || field("BLUE","PROT") ,                       01200000
  9125.                         || help.1 ,                                     01210000
  9126.                         || sba(fs.scrrows-1,-1) ,                       01220000
  9127.                         || field("BLUE","PROT") ,                       01230000
  9128.                         || help.2                                       01240000
  9129.                                                                         01250000
  9130.     i = 1; j = ko                                                       01260000
  9131.     Do While i <= kl & j <= ki                                          01270000
  9132.                                                                         01280000
  9133. /*      'CALLPIPE VAR FILE.' || i '| XLATE OUTPUT' ,                    01290000
  9134.             '| XLATE *-* 00-3F 40 FF 40 | VAR _LINE'                  */01300000
  9135.                                                                         01310000
  9136.         wscreen = wscreen || sba(i+2,-1) || field("GREEN","PROT")       01320000
  9137.         wscreen = wscreen || file.j                                     01330000
  9138.         i = i + 1;  j = j + 1                                           01340000
  9139.         End                                                             01350000
  9140.                                                                         01360000
  9141.     rscreen = write_read(wscreen || sba(row,col) || '13'x)              01370000
  9142.     Parse Var rscreen 1 aid 2 offset . '11'x rscreen                    01380000
  9143.     offset = fix(offset)                                                01390000
  9144.     row = offset % fs.scrcols; col = offset // fs.scrcols               01400000
  9145.                                                                         01410000
  9146.     /*  keep the  row/col  values within bounds  */                     01420000
  9147.     row = 3     /* just reset it */                                     01430000
  9148.     col = 0     /* just reset it */                                     01440000
  9149.                                                                         01450000
  9150.     Select /* aid */                                                    01460000
  9151.         When  aid = '7D'x   /* enter */ Then nop                        01470000
  9152.         When  aid = 'F2'x   /*  PF2  */ | ,                             01480000
  9153.               aid = 'C2'x   /*  PF14 */ | ,                             01490000
  9154.               aid = '7B'x   /*  PF11 */ | ,                             01500000
  9155.               aid = '4B'x   /*  PF23 */ Then Call SUBXEDIT              01510000
  9156.         When  aid = 'F3'x   /*  PF3  */ | ,                             01520000
  9157.               aid = 'C3'x   /*  PF15 */ Then Leave                      01530000
  9158.         When  aid = 'F4'x   /*  PF4  */ | ,                             01540000
  9159.               aid = 'C4'x   /*  PF16 */ Then Call PRINT                 01550000
  9160.         When  aid = 'F5'x   /*  PF5  */ | ,                             01560000
  9161.               aid = 'C5'x   /*  PF17 */ Then Call SAVE                  01570000
  9162.         When  aid = 'F6'x   /*  PF6  */ | ,                             01580000
  9163.               aid = 'C6'x   /*  PF18 */ Then Call FIND                  01590000
  9164.         When  aid = 'F7'x   /*  PF7  */ | ,                             01600000
  9165.               aid = 'C7'x   /*  PF19 */ Then ko = Max(ko-kl+1,1)        01610000
  9166.         When  aid = 'F8'x   /*  PF8  */ | ,                             01620000
  9167.               aid = 'C8'x   /*  PF20 */ Then ko = Min(ko+kl-1,ki)       01630000
  9168.         When  aid = 'F9'x   /*  PF9  */ | ,                             01640000
  9169.               aid = 'C9'x   /*  PF21 */ Then  Call  MARK                01650000
  9170.         When  aid = '7A'x   /*  PF10 */ | ,                             01660000
  9171.               aid = '4A'x   /*  PF22 */ Then  Call  BOOKLIST            01670000
  9172.         When  aid = '6D'x   /* clear */ | ,                             01680000
  9173.               aid = '6E'x   /*  PA2  */ Then Do                         01690000
  9174.             row = 3; col = 0; ko = 1                                    01700000
  9175.             End  /*  When ..  Do  */                                    01710000
  9176.         When  aid = '7C'x   /*  PF12 */ | ,                             01720000
  9177.               aid = '4C'x   /*  PF24 */ | ,                             01730000
  9178.               aid = 'F0'x   /* sysrq */ | ,                             01740000
  9179.               aid = '6C'x   /*  PA1  */ Then  quit = 1                  01750000
  9180.         When  aid = 'F1'x   /*  PF1  */ | ,                             01760000
  9181.               aid = 'C1'x   /*  PF13 */ Then  Call  HELP                01770000
  9182.         When  aid = '00'x               Then Do                         01780000
  9183.             /*  I/O error on screen  */                                 01790000
  9184.             'CALLPIPE COMMAND XMITMSG 925 (APPLID GOP' ,                01800000
  9185.                     'CALLER FVW ERRMSG | STEM MESSAGE. APPEND'          01810000
  9186.               Leave                                                     01820000
  9187.               End                                                       01830000
  9188.         Otherwise  Do   /*  Undefined PFkey/PAkey  */                   01840000
  9189.             'CALLPIPE COMMAND XMITMSG 657 "' || c2x(aid) || '"' ,       01850000
  9190.                 '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'  01860000
  9191.             End  /*  Otherwise  Do  */                                  01870000
  9192.         End  /*  Select  aid  */                                        01880000
  9193.                                                                         01890000
  9194.     If quit Then Leave                                                  01900000
  9195.                                                                         01910000
  9196.     End  /*  Do  Forever  */                                            01920000
  9197.                                                                         01930000
  9198. If quit Then command = "QUIT"                                           01940000
  9199.                                                                         01950000
  9200. Return                                                                  01960000
  9201.                                                                         01970000
  9202.                                                                         01980000
  9203.                                                                         01990000
  9204. /* =============================================================== XEDIT02000000
  9205.  *  Take the "file" from the input stream and pass it to CMS XEDIT.     02010000
  9206.  */                                                                     02020000
  9207. XEDIT:                                                                  02030000
  9208.                                                                         02040000
  9209. If fs.tube ^= "" Then Do                                                02050000
  9210.     /*  "Can't run XEDIT on this terminal."  */                         02060000
  9211.     'CALLPIPE COMMAND XMITMSG 512 "XEDIT"' ,                            02070000
  9212.             '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'      02080000
  9213.     Return                                                              02090000
  9214.     End /* If .. Do */                                                  02100000
  9215.                                                                         02110000
  9216. /*  stash this in a temporary file  */                                  02120000
  9217. 'CALLPIPE *: | > VMGOPHER DOCUMENT A3'                                  02130000
  9218.                                                                         02140000
  9219. /*  what's the real name of the file?  */                               02150000
  9220. Parse Value gopclifi(path) With fn ft .                                 02160000
  9221. Push "COMMAND SET FNAME" fn                                             02170000
  9222. Push "COMMAND SET FTYPE" ft                                             02180000
  9223. Push "COMMAND SET FMODE A1"                                             02190000
  9224.                                                                         02200000
  9225. /*  now invoke XEDIT  */                                                02210000
  9226. 'CALLPIPE COMMAND STATE GOPXEDPR XEDIT *'                               02220000
  9227. If rc = 0 Then Address "COMMAND" ,                                      02230000
  9228.                 'XEDIT VMGOPHER DOCUMENT A (PROFILE GOPXEDPR'           02240000
  9229.           Else Address "COMMAND" ,                                      02250000
  9230.                 'XEDIT VMGOPHER DOCUMENT A'                             02260000
  9231.                                                                         02270000
  9232. Return                                                                  02280000
  9233.                                                                         02290000
  9234.                                                                         02300000
  9235.                                                                         02310000
  9236. /* ============================================================== BROWSE02320000
  9237.  *  Take the "file" from the input stream and pass it to CMS BROWSE.    02330000
  9238.  */                                                                     02340000
  9239. BROWSE:                                                                 02350000
  9240.                                                                         02360000
  9241. If fs.tube ^= "" Then Do                                                02370000
  9242.     /*  "Can't run BROWSE on this terminal."  */                        02380000
  9243.     'CALLPIPE COMMAND XMITMSG 512 "BROWSE"' ,                           02390000
  9244.             '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'      02400000
  9245.     Return                                                              02410000
  9246.     End /* If .. Do */                                                  02420000
  9247.                                                                         02430000
  9248. Parse Value gopclifi(path) With fn ft .                                 02440000
  9249. filespec = fn ft 'A'                                                    02450000
  9250.                                                                         02460000
  9251. 'CALLPIPE CMS STATE' filespec '| STEM MESSAGE.'                         02470000
  9252. If  rc ^= 0 & rc ^= 28 & rc ^= 20  Then Return                          02480000
  9253. If  rc = 0 | rc = 20  Then Do                                           02490000
  9254.     fn = "VMGOPHER"                                                     02500000
  9255.     ft = "DOCUMENT"                                                     02510000
  9256.     End  /*  If  ..  Do  */                                             02520000
  9257. message.0 = 0                                                           02530000
  9258.                                                                         02540000
  9259. /*  stash this in a temporary file  */                                  02550000
  9260. 'CALLPIPE *: | >' fn ft 'A3'                                            02560000
  9261.                                                                         02570000
  9262. /* stash this in a temporary file and invoke BROWSE */                  02580000
  9263. Address "COMMAND" 'BROWSE' filespec                                     02590000
  9264.                                                                         02600000
  9265. Return                                                                  02610000
  9266.                                                                         02620000
  9267.                                                                         02630000
  9268.                                                                         02640000
  9269. /* ============================================================ ANYOTHER02650000
  9270.  *  View the file with some unknown text editor or file browser.        02660000
  9271.  */                                                                     02670000
  9272. ANYOTHER:                                                               02680000
  9273.                                                                         02690000
  9274. If fs.tube ^= "" Then Do                                                02700000
  9275.     /*  "Can't run" viewer "on this terminal."  */                      02710000
  9276.     'CALLPIPE COMMAND XMITMSG 512 VIEWER' ,                             02720000
  9277.             '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'      02730000
  9278.     Return                                                              02740000
  9279.     End /* If .. Do */                                                  02750000
  9280.                                                                         02760000
  9281. Parse Value gopclifi(path) With fn ft .                                 02770000
  9282. filespec = fn ft 'A'                                                    02780000
  9283.                                                                         02790000
  9284. 'CALLPIPE CMS STATE' filespec '| STEM MESSAGE.'                         02800000
  9285. If  rc ^= 0 & rc ^= 28 & rc ^= 20  Then Return                          02810000
  9286. If  rc = 0 | rc = 20  Then Do                                           02820000
  9287.     fn = "VMGOPHER"                                                     02830000
  9288.     ft = "DOCUMENT"                                                     02840000
  9289.     End  /*  If  ..  Do  */                                             02850000
  9290. message.0 = 0                                                           02860000
  9291.                                                                         02870000
  9292. /*  stash this in a temporary file  */                                  02880000
  9293. 'CALLPIPE *: | >' fn ft 'A3'                                            02890000
  9294.                                                                         02900000
  9295. /* stash this in a temporary file and invoke the viewer  */             02910000
  9296. 'CALLPIPE CMS' viewer filespec '| CONSOLE'                              02920000
  9297.                                                                         02930000
  9298. Return                                                                  02940000
  9299.                                                                         02950000
  9300.                                                                         02960000
  9301.                                                                         02970000
  9302. /* ---------------------------------------------------------------- HELP02980000
  9303.  * Invoke CMS HELP passing any supplied argument (context sensitive).   02990000
  9304.  */                                                                     03000000
  9305. HELP:     Procedure Expose fs. message.                                 03010000
  9306.                                                                         03020000
  9307. If fs.tube ^= "" Then                                                   03030000
  9308.     'CALLPIPE COMMAND HELP GOPHER VIEWER (ALL' ,                        03040000
  9309.         '| GOPCLIFV VIEWER HELP' ,                                      03050000
  9310.             '| STEM MESSAGE. APPEND'                                    03060000
  9311.                                                                         03070000
  9312. Else Do                                                                 03080000
  9313.     'CALLPIPE COMMAND HELP GOPHER VIEWER'                               03090000
  9314.     Address "COMMAND" 'VMFCLEAR'                                        03100000
  9315.     End  /*  Else  Do  */                                               03110000
  9316.                                                                         03120000
  9317. Return                                                                  03130000
  9318.                                                                         03140000
  9319.                                                                         03150000
  9320.                                                                         03160000
  9321. /* ------------------------------------------------------------ SUBXEDIT03170000
  9322.  *  Take the file in storage and pass it to CMS XEDIT.                  03180000
  9323.  */                                                                     03190000
  9324. SUBXEDIT:                                                               03200000
  9325.                                                                         03210000
  9326. If fs.tube ^= "" Then Do                                                03220000
  9327.     /*  "Can't run XEDIT on this terminal."  */                         03230000
  9328.     'CALLPIPE COMMAND XMITMSG 512 "XEDIT"' ,                            03240000
  9329.             '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'      03250000
  9330.     Return                                                              03260000
  9331.     End /* If .. Do */                                                  03270000
  9332.                                                                         03280000
  9333. /*  stash this in a temporary file  */                                  03290000
  9334. 'CALLPIPE STEM FILE. | > VMGOPHER DOCUMENT A3'                          03300000
  9335.                                                                         03310000
  9336. /*  what's the real name of the file?  */                               03320000
  9337. Parse Value gopclifi(path) With fn ft .                                 03330000
  9338. Push "COMMAND SET FNAME" fn                                             03340000
  9339. Push "COMMAND SET FTYPE" ft                                             03350000
  9340. Push "COMMAND SET FMODE A1"                                             03360000
  9341.                                                                         03370000
  9342. /*  now invoke XEDIT  */                                                03380000
  9343. 'CALLPIPE COMMAND STATE GOPXEDPR XEDIT *'                               03390000
  9344. If rc = 0 Then Address "COMMAND" ,                                      03400000
  9345.                 'XEDIT VMGOPHER DOCUMENT A (PROFILE GOPXEDPR'           03410000
  9346.           Else Address "COMMAND" ,                                      03420000
  9347.                 'XEDIT VMGOPHER DOCUMENT A'                             03430000
  9348.                                                                         03440000
  9349. Return                                                                  03450000
  9350.                                                                         03460000
  9351.                                                                         03470000
  9352.                                                                         03480000
  9353. /* --------------------------------------------------------------- PRINT03490000
  9354.  *  Take the current "file" in context and send it to the user's        03500000
  9355.  *  virtual printer.  Printer may be SPOOLed CONTinuous.                03510000
  9356.  */                                                                     03520000
  9357. PRINT:                                                                  03530000
  9358.                                                                         03540000
  9359. If fs.tube ^= "" Then Do                                                03550000
  9360.     /*  "Can't PRINT from this terminal."  */                           03560000
  9361.     'CALLPIPE COMMAND XMITMSG 507 (APPLID GOP CALLER FVW ERRMSG' ,      03570000
  9362.             '| STEM MESSAGE. APPEND'                                    03580000
  9363.     Return                                                              03590000
  9364.     End /* If .. Do */                                                  03600000
  9365.                                                                         03610000
  9366. 'CALLPIPE STEM FILE. | PRINT (TITLE' name '| STEM MESSAGE. APPEND'      03620000
  9367.                                                                         03630000
  9368. Return                                                                  03640000
  9369.                                                                         03650000
  9370.                                                                         03660000
  9371.                                                                         03670000
  9372. /* ---------------------------------------------------------------- SAVE03680000
  9373.  * Save the current file being viewed to the user's A disk.             03690000
  9374.  */                                                                     03700000
  9375. SAVE:                                                                   03710000
  9376.                                                                         03720000
  9377. If fs.tube ^= "" Then Do                                                03730000
  9378.     Call MESSAGE "Can't SAVE files via this terminal."                  03740000
  9379.     Return                                                              03750000
  9380.     End /* If .. Do */                                                  03760000
  9381.                                                                         03770000
  9382. Parse Value gopclifi(path) With fn ft .                                 03780000
  9383. filespec = fn ft 'A'                                                    03790000
  9384.                                                                         03800000
  9385. 'CALLPIPE CMS STATE' filespec '| STEM MESSAGE.'                         03810000
  9386. If rc = 0 Then Do                                                       03820000
  9387.     'CALLPIPE COMMAND XMITMSG 24 FILESPEC' ,                            03830000
  9388.         '| SPLIT AT /;/ | TAKE | STEM MESSAGE.'                         03840000
  9389.     Return                                                              03850000
  9390.     End  /*  If  ..  Do  */                                             03860000
  9391. If rc ^= 28 Then Return                                                 03870000
  9392. message.0 = 0                                                           03880000
  9393.                                                                         03890000
  9394. 'CALLPIPE STEM FILE. | >' filespec                                      03900000
  9395. If rc = 0 Then Do                                                       03910000
  9396.     /*  Creating new file:  */                                          03920000
  9397.     'CALLPIPE COMMAND XMITMSG 571 | STEM MESSAGE. APPEND'               03930000
  9398.     message.1 = message.1 filespec                                      03940000
  9399. /*  Call message "Created" filespec "from" path  */                     03950000
  9400.     End  /*  If  ..  Do  */                                             03960000
  9401.                                                                         03970000
  9402. Return                                                                  03980000
  9403.                                                                         03990000
  9404.                                                                         04000000
  9405.                                                                         04010000
  9406. /* ---------------------------------------------------------------- FIND04020000
  9407.  *  Find a particular string within the file being viewed.              04030000
  9408.  */                                                                     04040000
  9409. FIND:                                                                   04050000
  9410.                                                                         04060000
  9411. 'CALLPIPE COMMAND XMITMSG 602 "' || needle || '" (APPLID GOP' ,         04070000
  9412.         'CALLER MNU NOHEADER | GOPCLIUI | VAR NEEDLE'                   04080000
  9413. needle = Translate(Strip(needle))                                       04090000
  9414. If needle = "" Then Return                                              04100000
  9415.                                                                         04110000
  9416. Do i = ko + 1 to ki                                                     04120000
  9417.     If Index(Translate(file.i),needle) > 0 Then Do                      04130000
  9418.         ko = i                                                          04140000
  9419.         Return                                                          04150000
  9420.         End  /*  If  ..  Do  */                                         04160000
  9421.     End  /*  Do  For  */                                                04170000
  9422.                                                                         04180000
  9423. /*  'CALLPIPE COMMAND XMITMSG 546 (ERRMSG'  CALLER DMS is OK  */        04190000
  9424. /*  "Target not found"  */                                              04200000
  9425. 'CALLPIPE COMMAND XMITMSG 546 (APPLID GOP CALLER MNU ERRMSG' ,          04210000
  9426.         '| STEM MESSAGE. APPEND'                                        04220000
  9427.                                                                         04230000
  9428. Return                                                                  04240000
  9429.                                                                         04250000
  9430.                                                                         04260000
  9431.                                                                         04270000
  9432.                                                                         04280000
  9433. /* ---------------------------------------------------------------- MARK04290000
  9434.  *  Save a book mark referencing this file.                             04300000
  9435.  */                                                                     04310000
  9436. MARK:                                                                   04320000
  9437.                                                                         04330000
  9438. If fs.tube ^= "" Then Do                                                04340000
  9439.     /*  "Can't set bookmarks from this screen."  */                     04350000
  9440.     'CALLPIPE COMMAND XMITMSG 43 (APPLID GOP CALLER FVW ERRMSG' ,       04360000
  9441.             '| STEM MESSAGE. APPEND'                                    04370000
  9442.     Return                                                              04380000
  9443.     End /* If .. Do */                                                  04390000
  9444.                                                                         04400000
  9445. Address "COMMAND" 'GLOBALV SELECT GOPHER GET BOOKMARK.0'                04410000
  9446. If ^Datatype(bookmark.0,'N') Then bookmark.0 = 0                        04420000
  9447. i = bookmark.0 + 1                                                      04430000
  9448. bookmark.i = item                                                       04440000
  9449. Address "COMMAND" 'GLOBALV SELECT GOPHER PUTP BOOKMARK.' || i           04450000
  9450. bookmark.0 = i                                                          04460000
  9451. Address "COMMAND" 'GLOBALV SELECT GOPHER PUTP BOOKMARK.0'               04470000
  9452.                                                                         04480000
  9453. If rc = 0 Then 'CALLPIPE COMMAND XMITMSG 41 I' ,                        04490000
  9454.     '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'              04500000
  9455.     /*  "Bookmark" i "saved."  */                                       04510000
  9456.           Else 'CALLPIPE COMMAND XMITMSG 514 RC "GLOBALV"' ,            04520000
  9457.         '(APPLID GOP CALLER FVW ERRMSG | STEM MESSAGE. APPEND'          04530000
  9458.                                                                         04540000
  9459. Return                                                                  04550000
  9460.                                                                         04560000
  9461.                                                                         04570000
  9462.                                                                         04580000
  9463. /* ------------------------------------------------------------ BOOKLIST04590000
  9464.  *  Call GOPCLI to show the lit of bookmarks.                           04600000
  9465.  */                                                                     04610000
  9466. BOOKLIST:                                                               04620000
  9467.                                                                         04630000
  9468. Address "CMS" 'GOPCLI (BOOKLIST'                                        04640000
  9469.                                                                         04650000
  9470. Return                                                                  04660000
  9471.                                                                         04670000
  9472.                                                                         04680000
  9473.                                                                         04690000
  9474. /* ----------------------------------------------------------------- FIX04700000
  9475.  * Takes an inbound 3270 DS screen address (two bytes)                  04710000
  9476.  * and returns the equivalent byte offset in decimal.                   04720000
  9477.  */                                                                     04730000
  9478. FIX:                                                                    04740000
  9479. Parse Arg o,.                                                           04750000
  9480. Parse Var o 1 o1 2 o2 3 .                                               04760000
  9481. o1 = c2d(o1)                                                            04770000
  9482. o2 = c2d(o2)                                                            04780000
  9483. If o1 < 64 Then Return o1 * 256 + o2                                    04790000
  9484.            Else Return (o1 // 64) * 64 + (o2 // 64)                     04800000
  9485.                                                                         04810000
  9486.                                                                         04820000
  9487.                                                                         04830000
  9488. /* ---------------------------------------------------------- WRITE_READ04840000
  9489.  * Display what we have, then wait for user input and return it.        04850000
  9490.  */                                                                     04860000
  9491. WRITE_READ: Procedure Expose fs.                                        04870000
  9492. Parse Arg ws,wcc,wrt,.                                                  04880000
  9493. If wcc = "" Then wcc = 'C3'x                                            04890000
  9494. /*  If wrt = "" Then wrt = 'C0'x  */                                    04900000
  9495. If wrt = "" Then wrt = fs.write                                         04910000
  9496. ws = wrt || wcc || ws                                                   04920000
  9497. 'CALLPIPE VAR WS | FULLSCR' fs.tube '| VAR RS'                          04930000
  9498. If rc ^= 0 Then rs = '000000'x                                          04940000
  9499. Return rs                                                               04950000
  9500.                                                                         04960000
  9501.                                                                         04970000
  9502.                                                                         04980000
  9503. /* ----------------------------------------------------------------- SBA04990000
  9504.  * (a better SBA function extracted from PIPEDEMO; thanks, Chuck!)      05000000
  9505.  * Construct Set Buffer Address order from row and column.              05010000
  9506.  */                                                                     05020000
  9507.                                                                         05030000
  9508. SBA:      Procedure Expose fs.                                          05040000
  9509.                                                                         05050000
  9510. arg row , col, .                                                        05060000
  9511. row = Trunc(row)                                                        05070000
  9512. col = Trunc(col)                                                        05080000
  9513.                                                                         05090000
  9514. /*-----------------------------------------------------------------*/   05100000
  9515. /* Calculate binary address.                                       */   05110000
  9516. /*-----------------------------------------------------------------*/   05120000
  9517.                                                                         05130000
  9518. offset = row * fs.scrcols + col                                         05140000
  9519. Do While offset < 0; offset = offset + fs.scrrows * fs.scrcols; End     05150000
  9520.                                                                         05160000
  9521. if fs.14bit then return '11'x || d2c(offset,2)                          05170000
  9522.                                                                         05180000
  9523. /*-----------------------------------------------------------------*/   05190000
  9524. /* Convert to six-bit format. (xxxx111111111111 -> 0011111100111111*/   05200000
  9525. /*-----------------------------------------------------------------*/   05210000
  9526.                                                                         05220000
  9527. 'CALLPIPE var offset'               ,   /* Start with char number.    */05230000
  9528.     '| spec 1-* d2c 1.2 right'      ,   /* Convert to binary.         */05240000
  9529.     '| spec 1-* c2b 1'              ,   /* Convert to bit string.     */05250000
  9530.     '| spec /00/ 1  5.6  3'         ,   /* Place first six bits.      */05260000
  9531.            '/00/ 9 11.6 11'         ,   /* Place second six bits.     */05270000
  9532.     '| spec 1-* b2c 1'              ,   /* Convert back to binary.    */05280000
  9533.     '| xlate *-* 00-3F 40-7F'       ,   /* Translate to coded         */05290000
  9534.                 '01-09 C1-C9'       ,   /*   buffer address.          */05300000
  9535.                 '11-19 D1-D9'       ,   /*                            */05310000
  9536.                 '22-29 E2-E9'       ,   /*                            */05320000
  9537.                 '30-39 F0-F9'       ,   /*                            */05330000
  9538.     '| spec x11 1 1.2 2'            ,   /* Prefix with SBA order.     */05340000
  9539.     '| var offset'                      /* Put back in variable.      */05350000
  9540.                                                                         05360000
  9541. Return offset                                                           05370000
  9542.                                                                         05380000
  9543.                                                                         05390000
  9544.                                                                         05400000
  9545. /* --------------------------------------------------------------- FIELD05410000
  9546.  * Generate the 3270 DS sequence for extended field attributes          05420000
  9547.  * (if available).                                                      05430000
  9548.  */                                                                     05440000
  9549. FIELD:    Procedure Expose fs.                                          05450000
  9550. a = '00'x                                                               05460000
  9551. b = '00'x                                                               05470000
  9552. c = 'F1'x                                                               05480000
  9553. i = 1                                                                   05490000
  9554. Do While Arg(i) ^= ""                                                   05500000
  9555.     Select  /*  at  */                                                  05510000
  9556.         When Abbrev("PROTECTED",Arg(i),2)   Then a = bitor(a,'20'x)     05520000
  9557.         When Abbrev("SKIP",Arg(i),1)        Then a = bitor(a,'10'x)     05530000
  9558.         When Abbrev("NODISPLAY",Arg(i),1)   Then a = bitor(a,'0C'x)     05540000
  9559.         When Abbrev("HIGH",Arg(i),1)        Then a = bitor(a,'08'x)     05550000
  9560.         When Abbrev("BLINK",Arg(i),3)       Then b = bitor(b,'01'x)     05560000
  9561.         When Abbrev("REVERSE",Arg(i),3)     Then b = bitor(b,'02'x)     05570000
  9562.         When Abbrev("UNDERLINE",Arg(i),1)   Then b = bitor(b,'04'x)     05580000
  9563.         When Abbrev("BLUE",Arg(i),3)        Then c = 'F1'x              05590000
  9564.         When Abbrev("RED",Arg(i),3)         Then c = 'F2'x              05600000
  9565.         When Abbrev("PINK",Arg(i),1)        Then c = 'F3'x              05610000
  9566.         When Abbrev("GREEN",Arg(i),1)       Then c = 'F4'x              05620000
  9567.         When Abbrev("TURQUOISE",Arg(i),1)   Then c = 'F5'x              05630000
  9568.         When Abbrev("YELLOW",Arg(i),1)      Then c = 'F6'x              05640000
  9569.         When Abbrev("WHITE",Arg(i),1)       Then c = 'F7'x              05650000
  9570.         Otherwise nop                                                   05660000
  9571.         End  /*  Select  at  */                                         05670000
  9572.     i = i + 1                                                           05680000
  9573.     End  /*  Do  While  */                                              05690000
  9574.                                                                         05700000
  9575. If  ^fs.color   | ,                                                     05710000
  9576.     ^fs.exthi   Then    Return '1D'x || bitor(a,'40'x)                  05720000
  9577.                 Else    Return '2902'x || ,                             05730000
  9578.                                'C0'x   || bitor(a,'40'x) || ,           05740000
  9579.                                '42'x   || bitor(c,'40'x)                05750000
  9580.                                                                         05760000
  9581. :READ  GOPCLIGV $REXX    A1 TMP200 01/25/93 15:25:18                            
  9582. /*                                                                      00010000
  9583.  *        Name: GOPCLIGV REXX                                           00020000
  9584.  *              VM TCP/IP Network GOPHER Client graphics viewer         00030000
  9585.  *              This file is part of CMS Gopher and not part of VMGIF.  00040000
  9586.  *      Author: Rick Troth, Rice University, Information Systems        00050000
  9587.  *        Date: 1992-Dec-23                                             00060000
  9588.  *                                                                      00070000
  9589.  *        Note: the first record must be at least long enough           00080000
  9590.  *              to identify the graphics format (magic number)          00090000
  9591.  */                                                                     00100000
  9592.                                                                         00110000
  9593. /*                                                                      00120000
  9594.  *      Copyright 1992 Richard M. Troth.   This software was developed  00130000
  9595.  *      with resources provided by Rice University and is intended      00140000
  9596.  *      to serve Rice's user community.   Rice has benefitted greatly   00150000
  9597.  *      from the free distribution of software,  therefore distribution 00160000
  9598.  *      of unmodified copies of this material is not restricted.        00170000
  9599.  *      You may change your own copy as needed.   Neither Rice          00180000
  9600.  *      University nor any of its employees or students shall be held   00190000
  9601.  *      liable for damages resulting from the use of this software.     00200000
  9602.  */                                                                     00210000
  9603.                                                                         00220000
  9604. /*  Trace "OFF"  */                                                     00230000
  9605.                                                                         00240000
  9606. 'PEEKTO RECORD'                                                         00250000
  9607. Select                                                                  00260000
  9608.     When Left(record,5) = '4749463837'x Then Signal GIF                 00270000
  9609.     Otherwise 'OUTPUT' "unknown graphics format"                        00280000
  9610.     End  /*  Select  */                                                 00290000
  9611.                                                                         00300000
  9612. Exit rc * (rc ^= 12)                                                    00310000
  9613.                                                                         00320000
  9614.                                                                         00330000
  9615.                                                                         00340000
  9616. /* ------------------------------------------------------------------ */00350000
  9617. GIF:                                                                    00360000
  9618.                                                                         00370000
  9619. /*  verify that we have the VMGIF disk accessed  */                     00380000
  9620. 'CALLPIPE CMS STATE VMGIF MODULE * | *:'                                00390000
  9621. If rc ^= 0 Then Exit rc                                                 00400000
  9622.                                                                         00410000
  9623. /*  try to stash the input stream in a temp file  */                    00420000
  9624. 'CALLPIPE *: | > TEMP#GIF GIF A3'                                       00430000
  9625. If rc ^= 0 Then Do                                                      00440000
  9626.     grc = rc                                                            00450000
  9627.     'CALLPIPE COMMAND ERASE TEMP#GIF GIF A'                             00460000
  9628.     Exit grc                                                            00470000
  9629.     End  /*  If  ..  Do  */                                             00480000
  9630.                                                                         00490000
  9631. /*  ensure that the right libraries are GLOBALed  */                    00500000
  9632. /*  (I loathe doing this)  */                                           00510000
  9633. 'CALLPIPE COMMAND QUERY TXTLIB' ,                                       00520000
  9634.     '| STRIP LEADING STRING /TXTLIB   = / | JOIN * | VAR TXTLIB'        00530000
  9635. Upper txtlib;   If Strip(txtlib) = "NONE" Then txtlib = ""              00540000
  9636. 'CALLPIPE COMMAND GLOBAL TXTLIB ADMPLIB ADMGLIB' txtlib                 00550000
  9637.                                                                         00560000
  9638. /*  now run VMGIF  */                                                   00570000
  9639. 'CALLPIPE CMS VMGIF -em5 TEMP#GIF | *:'; grc = rc                       00580000
  9640.                                                                         00590000
  9641. /*  restore GLOBALed libraries  */                                      00600000
  9642. 'CALLPIPE COMMAND GLOBAL TXTLIB' txtlib                                 00610000
  9643.                                                                         00620000
  9644. Exit grc                                                                00630000
  9645.                                                                         00640000
  9646. :READ  GOPCLIFI $EXEC    A1 TMP200 01/25/93 15:25:07                            
  9647. /*                                                                      00010000
  9648.  *        Name: GOPCLIFI EXEC (function)                                00020000
  9649.  *              returns a CMS fileid from a gopher path                 00030000
  9650.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  9651.  *        Date: 1992-Dec-10, 1993-Jan-15                                00050000
  9652.  *                                                                      00060000
  9653.  *              This file is part of CMS Gopher.                        00070000
  9654.  */                                                                     00080000
  9655.                                                                         00090000
  9656. Parse Source . call . . . arg0 .                                        00100000
  9657. If call ^= "FUNCTION" Then Do                                           00110000
  9658.     Say "Usage:" arg0 || "()"                                           00120000
  9659.     Exit                                                                00130000
  9660.     End                                                                 00140000
  9661.                                                                         00150000
  9662. Parse Arg path                                                          00160000
  9663. Parse Value Reverse(path) With name '/' path                            00170000
  9664. Parse Value Reverse(name) With name ',' . ';' vers                      00180000
  9665.                                                                         00190000
  9666. /*  input/output tables are built piecemeal to circumvent     *         00200000
  9667.  *  the 500 byte clause limit in older interpreters           */        00210000
  9668. i   =    '000102030405060708090A0B0C0D0E0F'x || ,                       00220000
  9669.          '101112131415161718191A1B1C1D1E1F'x || ,                       00230000
  9670.          '202122232425262728292A2B2C2D2E2F'x || ,                       00240000
  9671.          '303132333435363738393A3B3C3D3E3F'x                            00250000
  9672.                                                                         00260000
  9673. i = i || '404142434445464748494A4B4C4D4E4F'x || ,                       00270000
  9674.          '505152535455565758595A5B5C5D5E5F'x || ,                       00280000
  9675.          '606162636465666768696A6B6C6D6E6F'x || ,                       00290000
  9676.          '707172737475767778797A7B7C7D7E7F'x                            00300000
  9677.                                                                         00310000
  9678. i = i || '808182838485868788898A8B8C8D8E8F'x || ,                       00320000
  9679.          '909192939495969798999A9B9C9D9E9F'x || ,                       00330000
  9680.          'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'x || ,                       00340000
  9681.          'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'x                            00350000
  9682.                                                                         00360000
  9683. i = i || 'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'x || ,                       00370000
  9684.          'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'x || ,                       00380000
  9685.          'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'x || ,                       00390000
  9686.          'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'x                            00400000
  9687.                                                                         00410000
  9688. o   =    '40404040404040404040404040404040'x || ,                       00420000
  9689.          '40404040404040404040404040404040'x || ,                       00430000
  9690.          '40404040404040404040404040404040'x || ,                       00440000
  9691.          '40404040404040404040404040404040'x                            00450000
  9692.                                                                         00460000
  9693. o = o || '407C7C7C7C7C7C7C7C7C7C407C7C4E7C'x || ,                       00470000
  9694.          '7C7C7C7C7C7C7C7C7C7C7C5B7C7C7C7C'x || ,                       00480000
  9695.          '607C7C7C7C7C7C7C7C7C7C7C6C6D7C7C'x || ,                       00490000
  9696.          '7C7C7C7C7C7C7C7C7C7C7A7B7C7C7C7C'x                            00500000
  9697.                                                                         00510000
  9698. o = o || '7CC1C2C3C4C5C6C7C8C97C7C7C7C7C7C'x || ,                       00520000
  9699.          '7CD1D2D3D4D5D6D7D8D97C7C7C7C7C7C'x || ,                       00530000
  9700.          '7C7CE2E3E4E5E6E7E8E97C7C7C7C7C7C'x || ,                       00540000
  9701.          '7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C'x                            00550000
  9702.                                                                         00560000
  9703. o = o || '7CC1C2C3C4C5C6C7C8C97C7C7C7C7C7C'x || ,                       00570000
  9704.          '7CD1D2D3D4D5D6D7D8D97C7C7C7C7C7C'x || ,                       00580000
  9705.          '7C7CE2E3E4E5E6E7E8E97C7C7C7C7C7C'x || ,                       00590000
  9706.          'F0F1F2F3F4F5F6F7F8F97C7C7C7C7C7C'x                            00600000
  9707.                                                                         00610000
  9708. Parse Upper Value Translate(name,o,i) With fn ft .                      00620000
  9709. If fn = "" Then fn = "VMGOPHER"                                         00630000
  9710. If ft = "" Then ft = "DOCUMENT"                                         00640000
  9711. Return fn ft                                                            00650000
  9712.                                                                         00660000
  9713. :READ  GOPSRV   $EXEC    A1 TMP200 01/25/93 15:24:41                            
  9714. /*                                                                      00010000
  9715.  *        Name: GOPSRV EXEC                                             00020000
  9716.  *              A CMS-based Gopher Server                               00030000
  9717.  *              Based on the original, GOPHERD EXEC, from 2.3.          00040000
  9718.  *      Author: Rick Troth, Rice University, Information Systems        00050000
  9719.  *        Date: 1992-Apr-21, Aug-07, Oct-14, Dec-11, 1993-Jan-15        00060000
  9720.  */                                                                     00070000
  9721.                                                                         00080000
  9722. /*                                                                      00090000
  9723.  *      Copyright 1993 Richard M. Troth.   This software was developed  00100000
  9724.  *      with resources provided by Rice University and is intended      00110000
  9725.  *      to serve Rice's user community.   Rice has benefitted greatly   00120000
  9726.  *      from the free distribution of software,  therefore distribution 00130000
  9727.  *      of unmodified copies of this material is not restricted.        00140000
  9728.  *      You may change your own copy as needed.   Neither Rice          00150000
  9729.  *      University nor any of its employees or students shall be held   00160000
  9730.  *      liable for damages resulting from the use of this software.     00170000
  9731.  */                                                                     00180000
  9732.                                                                         00190000
  9733. /*                                                                      00200000
  9734.  *       Calls:                                                         00210000
  9735.  *              GOPSRVLS REXX     -- to read files and menus            00220000
  9736.  *              GOPSRVRP REXX     -- to resolve gopher paths            00230000
  9737.  *              GOPSRVMB REXX     -- to build menus for the client      00240000
  9738.  *                                                                      00250000
  9739.  *        Note: this program does *not* use RXSOCKET's translation      00260000
  9740.  *              option.   Translation between ASCII and EBCDIC          00270000
  9741.  *              is determined by the type of file requested.            00280000
  9742.  */                                                                     00290000
  9743.                                                                         00300000
  9744. progid = "CMS Gopher 2.4.0 server"                                      00310000
  9745. gopher = "Gopher"                                                       00320000
  9746. timeout = 5                                                             00330000
  9747.                                                                         00340000
  9748. Parse Source . . . . . arg0 .                                           00350000
  9749. argo = arg0 || ':'                                                      00360000
  9750. Parse Upper Arg root port . '(' . ')' .                                 00370000
  9751.                                                                         00380000
  9752. Address "COMMAND"                                                       00390000
  9753.                                                                         00400000
  9754. 'SET LANGUAGE (ADD GOP USER'                                            00410000
  9755.                                                                         00420000
  9756. host = "localhost"      /*  this will be reset to the actual name of  * 00430000
  9757.                          *  this host after RXSOCKET is initialized.  */00440000
  9758.                                                                         00450000
  9759.     stdin  = 0                                                          00460000
  9760.     stdout = 1                                                          00470000
  9761.     stderr = 2                                                          00480000
  9762.                                                                         00490000
  9763. Say argo progid "starting"                                              00500000
  9764.                                                                         00510000
  9765. logpipe = "CONSOLE"                                                     00520000
  9766. _root = Userid()                                                        00530000
  9767. _port = 70                                                              00540000
  9768. 'PIPE < GOPHERD CONFIG * | STEM CONFIG.'                                00550000
  9769. If rc = 0 Then                                                          00560000
  9770. Do i = 1 to config.0                                                    00570000
  9771.     If Left(config.i,1) = '*' Then Iterate                              00580000
  9772.     If Left(config.i,1) = '#' Then Iterate                              00590000
  9773.     If Index(config.i,'=') = 0 Then Iterate                             00600000
  9774.     Parse Var config.i var '=' val                                      00610000
  9775.     Upper var                                                           00620000
  9776.     Select  /*  var  */                                                 00630000
  9777.         When  Abbrev("LOGPIPE",var,3)   Then  logpipe = val             00640000
  9778.         When  Abbrev("ROOT",var,4)      Then  _root = val               00650000
  9779.         When  Abbrev("PORT",var,4)      Then  _port = val               00660000
  9780.         Otherwise 'XMITMSG 2 VAR (ERRMSG'                               00670000
  9781.         End  /*  Select  var  */                                        00680000
  9782.     End  /*  Do  For  */                                                00690000
  9783.                                                                         00700000
  9784. If root = "" Then root = _root                                          00710000
  9785. If port = "" Then port = _port                                          00720000
  9786.                                                                         00730000
  9787. If ^Datatype(port,'N') Then Do                                          00740000
  9788.     /*  "Gopher TCP/IP service port must be numeric."  */               00750000
  9789.     'XMITMSG 126 (APPLID GOP CALLER SRV ERRMSG'                         00760000
  9790.     Exit 24                                                             00770000
  9791.     End  /*  If  ..  Do  */                                             00780000
  9792.                                                                         00790000
  9793. /*                                                                      00800000
  9794.  *   Initialize RXSOCKET                                                00810000
  9795.  */                                                                     00820000
  9796. maxdesc = Socket('Initialize', gopher)                                  00830000
  9797. If maxdesc = "-1" Then Do                                               00840000
  9798.     Say argo tcperror()                                                 00850000
  9799.     Exit -1                                                             00860000
  9800.     End  /*  If  ..  Do  */                                             00870000
  9801. Say argo "RXSOCKET Initialized for" maxdesc "descriptors"               00880000
  9802.                                                                         00890000
  9803.                                                                         00900000
  9804. /*                                                                      00910000
  9805.  *   Request the name of this host                                      00920000
  9806.  */                                                                     00930000
  9807. rc = Socket('GetHostName', 'HOST')                                      00940000
  9808. If rc = "-1" Then Do                                                    00950000
  9809.     Say argo tcperror()                                                 00960000
  9810.     Exit -1                                                             00970000
  9811.     End  /*  If  ..  Do  */                                             00980000
  9812. Say argo "LocalHost =" host                                             00990000
  9813.                                                                         01000000
  9814.                                                                         01010000
  9815. /*                                                                      01020000
  9816.  *   Request a new socket descriptor (TCP protocol)                     01030000
  9817.  */                                                                     01040000
  9818. socket = Socket('Socket', 'AF_INET', 'Sock_Stream')                     01050000
  9819. If socket = "-1" Then Do                                                01060000
  9820.     Say argo tcperror()                                                 01070000
  9821.     Exit -1                                                             01080000
  9822.     End  /*  If  ..  Do  */                                             01090000
  9823. Say argo "Primary socket =" socket                                      01100000
  9824.                                                                         01110000
  9825.                                                                         01120000
  9826. /*                                                                      01130000
  9827.  *   Set this socket to non-blocking mode                               01140000
  9828.  */                                                                     01150000
  9829. rc = Socket('Ioctl', socket, 'FIONBIO', 1)                              01160000
  9830. If rc = "-1" Then                                                       01170000
  9831.     Say argo tcperror()                                                 01180000
  9832.                                                                         01190000
  9833.                                                                         01200000
  9834. /*                                                                      01210000
  9835.  *                                                                      01220000
  9836.  */                                                                     01230000
  9837. name = AF_INET || Htons(port)                                           01240000
  9838.                                                                         01250000
  9839. rc = Socket('Bind', socket, name)                                       01260000
  9840. If rc = "-1" Then Do                                                    01270000
  9841.     Say argo tcperror()                                                 01280000
  9842.     Exit -1                                                             01290000
  9843.     End  /*  If  ..  Do  */                                             01300000
  9844. Say argo "Bound to port" port                                           01310000
  9845.                                                                         01320000
  9846.                                                                         01330000
  9847. /*                                                                      01340000
  9848.  *                                                                      01350000
  9849.  */                                                                     01360000
  9850. rc = Socket('Listen', socket, maxdesc)                                  01370000
  9851. If rc = "-1" Then Do                                                    01380000
  9852.     Say argo tcperror()                                                 01390000
  9853.     Exit -1                                                             01400000
  9854.     End  /*  If  ..  Do  */                                             01410000
  9855. /*  Say argo "Listening ..."  */                                        01420000
  9856.                                                                         01430000
  9857. /*  UNIX and VMS style logging:  */                                     01440000
  9858. Parse Value Date('S') With 1 yy 5 mm 7 dd 9 .                           01450000
  9859. day = Left(Date('W'),3)                                                 01460000
  9860. mon = Left(Date('M'),3)                                                 01470000
  9861. time = Time()                                                           01480000
  9862. userid = Userid()                                                       01490000
  9863. /*  "Starting gopher daemon" Userid()  */                               01500000
  9864. 'PIPE COMMAND XMITMSG 120 DAY MON DD TIME YY HOST USERID' ,             01510000
  9865.         '(APPLID GOP CALLER SRV ERRMSG |' logpipe                       01520000
  9866.                                                                         01530000
  9867. Say argo progid "waiting for a connection"                              01540000
  9868.                                                                         01550000
  9869. 'GLOBALV SELECT GOPHERD PUT HOST PORT ROOT'                             01560000
  9870.                                                                         01570000
  9871. Do Forever                                                              01580000
  9872.                                                                         01590000
  9873.     rc = FD_ZERO('readmask')            /* must be reset each time */   01600000
  9874.     rc = FD_SET(socket, 'readmask')                                     01610000
  9875.     rc = FD_SET(stdin, 'readmask')                                      01620000
  9876.                                                                         01630000
  9877.     Say "*"     /* waiting */                                           01640000
  9878.     rc = Socket('Select', socket + 1, 'readmask', 0, 0, 0)              01650000
  9879.     If rc = "-1" Then Do                                                01660000
  9880.         Say argo tcperror()                                             01670000
  9881.         Leave                                                           01680000
  9882.         End  /*  If  ..  Do  */                                         01690000
  9883.                                                                         01700000
  9884.     If FD_ISSET(stdin, 'readmask') = 1 Then Leave                       01710000
  9885.     If FD_ISSET(socket, 'readmask') ^= 1 Then Iterate                   01720000
  9886.                                                                         01730000
  9887.     /*                                                                  01740000
  9888.      *                                                                  01750000
  9889.      */                                                                 01760000
  9890.     ns = Socket('Accept', socket, 'CLIENT')                             01770000
  9891.     If ns = "-1" Then Do                                                01780000
  9892.         Say argo tcperror()                                             01790000
  9893.         Leave                                                           01800000
  9894.         End  /*  If  ..  Do  */                                         01810000
  9895.                                                                         01820000
  9896.     Say argo "Accepted" ns "at" Time() "client" c2x(client)             01830000
  9897.     Parse Var client . 5 r1 +1 r2 +1 r3 +1 r4 +1 .                      01840000
  9898.     cipa = c2d(r1) || "." || c2d(r2) || "." || ,                        01850000
  9899.            c2d(r3) || "." || c2d(r4)                                    01860000
  9900.     /*  Say argo "Client's IP address is" cipa  */                      01870000
  9901.                                                                         01880000
  9902.     /*  UNIX and VMS style logging:  */                                 01890000
  9903.     Parse Value Date('S') With 1 yyyy 5 mm 7 dd 9 .                     01900000
  9904.     day = Left(Date('W'),3)                                             01910000
  9905.     mon = Left(Date('M'),3)                                             01920000
  9906.     time = Time()                                                       01930000
  9907.                                                                         01940000
  9908.     /*                                                                  01950000
  9909.      *   Loop, reading the query line from the client.                  01960000
  9910.      */                                                                 01970000
  9911.     path = ""                                                           01980000
  9912.     Do Forever                                                          01990000
  9913.                                                                         02000000
  9914.         rc = FD_ZERO('readmask')        /* must be reset each time */   02010000
  9915.         rc = FD_SET(ns, 'readmask')                                     02020000
  9916.                                                                         02030000
  9917.         rc = Socket('Select', ns + 1, 'readmask', 0, 0, timeout)        02040000
  9918.         If rc = "-1" Then Do                                            02050000
  9919.             Say argo tcperror()                                         02060000
  9920.             Exit -1                                                     02070000
  9921.             End  /*  If  ..  Do  */                                     02080000
  9922.                                                                         02090000
  9923.         If FD_ISSET(ns, 'readmask') ^= 1 Then Leave                     02100000
  9924.                                                                         02110000
  9925.         pack = ""                                                       02120000
  9926.         bytes_in = Socket('Read', ns, 'PACK')                           02130000
  9927.         If bytes_in = "-1" Then                                         02140000
  9928.             Say argo tcperror()                                         02150000
  9929.         If bytes_in < 1 Then Leave                                      02160000
  9930.         If Index(pack,'0A'x) > 0 Then Leave /* ASCII LF */              02170000
  9931.         If Index(pack,'0D'x) > 0 Then Leave /* ASCII CR */              02180000
  9932.         path = path || pack                                             02190000
  9933.     End                                                                 02200000
  9934.     path = path || pack                                                 02210000
  9935.                                                                         02220000
  9936.     Parse Var path path '0A'x .     /* ASCII LF */                      02230000
  9937.     Parse Var path path '0D'x .     /* ASCII CR */                      02240000
  9938.     'PIPE VAR PATH | A2E | VAR PATH'                                    02250000
  9939.                                                                         02260000
  9940.     /*  refresh disk access  (same procedure as used by GONE EXEC)  */  02270000
  9941.     'PIPE CMS QUERY DISK | DROP | STEM STEM.'                           02280000
  9942.     Do i = 1 to stem.0                                                  02290000
  9943.         Parse Var stem.i . 8 va 12 fm .                                 02300000
  9944.         If Left(va,3) = "DIR" Then Iterate                              02310000
  9945.         'DISKWRIT' Left(fm,1)                                           02320000
  9946.         If rc = 1 Then 'ACCESS' va fm                                   02330000
  9947.         End  /*  Do  For  */                                            02340000
  9948.                                                                         02350000
  9949.     client = cipa                                                       02360000
  9950.     'GLOBALV SELECT GOPHERD PUT CLIENT'                                 02370000
  9951.                                                                         02380000
  9952.                                                                         02390000
  9953. Parse Var path path '05'x parm                                          02400000
  9954. Say argo "Requesting:" path                                             02410000
  9955. If parm ^= "" Then Say argo "+ Parms:" parm                             02420000
  9956.                                                                         02430000
  9957. Select  /*  type  */                                                    02440000
  9958.                                                                         02450000
  9959.     When path = "" Then Do                                              02460000
  9960.         type = '1'                                                      02470000
  9961.         logmsg = 121    /*  "Root Connection"  */                       02480000
  9962.         End  /*  When  ..  Do  */                                       02490000
  9963.                                                                         02500000
  9964.     When Left(path,1) = '1' Then Do                                     02510000
  9965.         Parse Var path 1 type 2 path                                    02520000
  9966.         logmsg = 122    /*  "retrieved directory" path  */              02530000
  9967.         End  /*  When  ..  Do  */                                       02540000
  9968.                                                                         02550000
  9969.     When Left(path,1) = '7' Then Do                                     02560000
  9970.         Parse Var path 1 type 2 path                                    02570000
  9971.         logmsg = 125    /*  "searched directory" path  */               02580000
  9972.         End  /*  When  ..  Do  */                                       02590000
  9973.                                                                         02600000
  9974.     When Left(path,1) = '/' Then Do                                     02610000
  9975.         type = '0'                                                      02620000
  9976.         logmsg = 123    /*  "retrieved file" path  */                   02630000
  9977.         End  /*  When  ..  Do  */                                       02640000
  9978.                                                                         02650000
  9979.     Otherwise Do                                                        02660000
  9980.         Parse Var path 1 type 2 path                                    02670000
  9981.         logmsg = 123    /*  "retrieved file" path  */                   02680000
  9982.         End  /*  Otherwise  Do  */                                      02690000
  9983.                                                                         02700000
  9984.     End  /*  Select  type  */                                           02710000
  9985.                                                                         02720000
  9986. 'GLOBALV SELECT GOPHERD PUT PATH PARM'                                  02730000
  9987. 'GLOBALV SELECT GOPHERD SET MENU'                                       02740000
  9988.                                                                         02750000
  9989. Select  /*  type  */                                                    02760000
  9990.                                                                         02770000
  9991.     When type = "0" Then        /* plain text file */                   02780000
  9992.         pipe = 'APPEND LITERAL .' || ,                                  02790000
  9993.             '| E2A | SPEC 1-* 1 x0D0A NEXT'                             02800000
  9994.                                                                         02810000
  9995.     When type = "1" Then        /* menu */                              02820000
  9996.         pipe = 'GOPSRVMB | APPEND LITERAL .' || ,                       02830000
  9997.             '| E2A | SPEC 1-* 1 x0D0A NEXT'                             02840000
  9998.                                                                         02850000
  9999.     When type = "7" Then        /* menu with search */                  02860000
  10000.         pipe = 'GOPSRVYS' parm '| GOPSRVMB | APPEND LITERAL .' || ,     02870000
  10001.             '| E2A | SPEC 1-* 1 x0D0A NEXT'                             02880000
  10002.                                                                         02890000
  10003.     When type = "9" | ,         /* binary */                            02900000
  10004.          type = "4" | ,         /* Mac file, send as binary */          02910000
  10005.          type = "5" | ,         /* PC file, send as binary */           02920000
  10006.          type = "I" | ,         /* send pictures as binary */           02930000
  10007.          type = "s" Then        /* sound, send as binary */             02940000
  10008. pipe = 'FBLOCK 8192'    /*  default processing  */                      02950000
  10009.                                                                         02960000
  10010.     When type = "p" Then        /* PostScript */                        02970000
  10011.         pipe = 'E2A | SPEC 1-* 1 x0D0A NEXT'                            02980000
  10012.                                                                         02990000
  10013.     When type = "r" | ,         /* record oriented file */              03000000
  10014.          type = "v" Then        /* var-length records */                03010000
  10015.         pipe = 'BLOCK 65531 CMS |' pipe                                 03020000
  10016.                                                                         03030000
  10017.     Otherwise                   /* send it as binary */                 03040000
  10018. pipe = 'FBLOCK 8192'    /*  default processing  */                      03050000
  10019.                                                                         03060000
  10020.     End  /*  Select  type  */                                           03070000
  10021.                                                                         03080000
  10022.     'PIPE GOPSRVLS' root '| GOPSRVRP' path ,                            03090000
  10023.             '|' pipe '| FBLOCK 8192 | STEM STEM.'                       03100000
  10024.                                                                         03110000
  10025. /*  If rc ^= 0 Then logrqest = logrqest "(rc=" || rc || ")"  */         03120000
  10026.                                                                         03130000
  10027. 'PIPE COMMAND XMITMSG' logmsg 'DAY MON DD TIME YY CLIENT PATH' ,        03140000
  10028.         '(APPLID GOP CALLER SRV ERRMSG |' logpipe                       03150000
  10029.                                                                         03160000
  10030.                                                                         03170000
  10031.     Say argo stem.0 "blocks to send"                                    03180000
  10032.     /*                                                                  03190000
  10033.      *   Send the response to our client                                03200000
  10034.      */                                                                 03210000
  10035.     Do i = 1 to stem.0                                                  03220000
  10036.         bytes_out = Socket('Write', ns, stem.i)                         03230000
  10037.         If bytes_out = "-1" Then Do                                     03240000
  10038.             Say argo tcperror()                                         03250000
  10039.             Leave                                                       03260000
  10040.             End  /*  If  ..  Do  */                                     03270000
  10041.         End  /*  Do  For  */                                            03280000
  10042.                                                                         03290000
  10043.                                                                         03300000
  10044.     /*                                                                  03310000
  10045.      *   All done, relinquish our socket descriptor                     03320000
  10046.      */                                                                 03330000
  10047.     rc = Socket('Close', ns)                                            03340000
  10048.     If rc = "-1" Then Do                                                03350000
  10049.         Say argo tcperror()                                             03360000
  10050.         Leave                                                           03370000
  10051.         End  /*  If  ..  Do  */                                         03380000
  10052.     Say argo "Closed" ns "at" Time()                                    03390000
  10053.                                                                         03400000
  10054.                                                                         03410000
  10055.     End  /*  Do  Forever  */                                            03420000
  10056.                                                                         03430000
  10057.                                                                         03440000
  10058. /*                                                                      03450000
  10059.  *   Tell RXSOCKET that we are done with this IUCV path                 03460000
  10060.  */                                                                     03470000
  10061. rc = Socket('Terminate')                                                03480000
  10062. If rc = "-1" Then Do                                                    03490000
  10063.     Say argo tcperror()                                                 03500000
  10064.     End  /*  If  ..  Do  */                                             03510000
  10065.                                                                         03520000
  10066.                                                                         03530000
  10067. Exit                                                                    03540000
  10068.                                                                         03550000
  10069. :READ  GOPSRVLS $REXX    A1 TMP200 01/25/93 15:24:37                            
  10070. /*                                                                      00010000
  10071.  *        Name: GOPSRVLS REXX                                           00020000
  10072.  *              list a file or directory, feeding to the next stage     00030000
  10073.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  10074.  *        Date: 1993-Jan-15, 19                                         00050000
  10075.  */                                                                     00060000
  10076.                                                                         00070000
  10077. /*                                                                      00080000
  10078.  *      Copyright 1993 Richard M. Troth.   This software was developed  00090000
  10079.  *      with resources provided by Rice University and is intended      00100000
  10080.  *      to serve Rice's user community.   Rice has benefitted greatly   00110000
  10081.  *      from the free distribution of software,  therefore distribution 00120000
  10082.  *      of unmodified copies of this material is not restricted.        00130000
  10083.  *      You may change your own copy as needed.   Neither Rice          00140000
  10084.  *      University nor any of its employees or students shall be held   00150000
  10085.  *      liable for damages resulting from the use of this software.     00160000
  10086.  */                                                                     00170000
  10087.                                                                         00180000
  10088. Parse Source . . arg0 .                                                 00190000
  10089. Parse Upper Arg fn ft fm . '(' . ')' .                                  00200000
  10090. If fn = "" Then fn = '*'                                                00210000
  10091. If ft = "" Then ft = '*'                                                00220000
  10092. If ft = "FILELIST" & Index(fn,'*') = 0 Then ft = "*"                    00230000
  10093. If fm = "" Then fm = '*'                                                00240000
  10094.                                                                         00250000
  10095. Parse Arg string                                                        00260000
  10096. Say arg0 || ':' string                                                  00270000
  10097.                                                                         00280000
  10098. Address "COMMAND" 'GLOBALV SELECT GOPHERD GET MENU NICK CLIENT'         00290000
  10099.                                                                         00300000
  10100. If menu ^= "" Then Do                                                   00310000
  10101.                                                                         00320000
  10102.                                                                         00330000
  10103.     Address "CMS" 'STATE' menu 'NAMES *'                                00340000
  10104.     If rc = 0 Then Do                                                   00350000
  10105.                                                                         00360000
  10106.         If nick = "" Then nick = "*"                                    00370000
  10107.                                                                         00380000
  10108.         'CALLPIPE COMMAND NAMEFIND :NICK' nick ':AUTH :PIPE' ,          00390000
  10109.                 '(FILE' menu '| VAR AUTH | DROP' ,                      00400000
  10110.         '| CHANGE' '00'x || '&0' || '00'x || nick || '00'x ,            00410000
  10111.         '| CHANGE' '00'x || '&1' || '00'x ||  fn  || '00'x ,            00420000
  10112.         '| CHANGE' '00'x || '&2' || '00'x ||  ft  || '00'x ,            00430000
  10113.         '| CHANGE' '00'x || '&3' || '00'x ||  fm  || '00'x ,            00440000
  10114.         '| CHANGE' '00'x || '&4' || '00'x || menu || '00'x ,            00450000
  10115.                 '| VAR PIPE'                                            00460000
  10116.                                                                         00470000
  10117.         If rc = 32 Then                                                 00480000
  10118.         'CALLPIPE COMMAND NAMEFIND :FN' fn ':FT' ft ':AUTH :PIPE' ,     00490000
  10119.                 '(FILE' menu '| VAR AUTH | DROP' ,                      00500000
  10120.         '| CHANGE' '00'x || '&0' || '00'x || nick || '00'x ,            00510000
  10121.         '| CHANGE' '00'x || '&1' || '00'x ||  fn  || '00'x ,            00520000
  10122.         '| CHANGE' '00'x || '&2' || '00'x ||  ft  || '00'x ,            00530000
  10123.         '| CHANGE' '00'x || '&3' || '00'x ||  fm  || '00'x ,            00540000
  10124.         '| CHANGE' '00'x || '&4' || '00'x || menu || '00'x ,            00550000
  10125.                 '| VAR PIPE'                                            00560000
  10126.                                                                         00570000
  10127.         If rc = 32 Then                                                 00580000
  10128.         'CALLPIPE COMMAND NAMEFIND :NICK * :AUTH :PIPE' ,               00590000
  10129.                 '(FILE' menu '| VAR AUTH | DROP' ,                      00600000
  10130.         '| CHANGE' '00'x || '&0' || '00'x || nick || '00'x ,            00610000
  10131.         '| CHANGE' '00'x || '&1' || '00'x ||  fn  || '00'x ,            00620000
  10132.         '| CHANGE' '00'x || '&2' || '00'x ||  ft  || '00'x ,            00630000
  10133.         '| CHANGE' '00'x || '&3' || '00'x ||  fm  || '00'x ,            00640000
  10134.         '| CHANGE' '00'x || '&4' || '00'x || menu || '00'x ,            00650000
  10135.                 '| VAR PIPE'                                            00660000
  10136.                                                                         00670000
  10137.         If rc = 0 Then Do                                               00680000
  10138.                                                                         00690000
  10139.             /*  if auth non-blank  */                                   00700000
  10140.             If ^gopsrvau(client,auth) Then Do                           00710000
  10141.                 /*  "access restricted"  */                             00720000
  10142.                 'CALLPIPE COMMAND XMITMSG 2380' ,                       00730000
  10143.                     '(CALLER GOP ERRMSG' ,                              00740000
  10144.                         '| SPEC /- / 1 1-* NEXT | *:'                   00750000
  10145.                 Exit rc                                                 00760000
  10146.                 End  /*  If  ..  Do  */                                 00770000
  10147.                                                                         00780000
  10148.             If pipe ^= "" Then Do                                       00790000
  10149.                 'CALLPIPE' pipe '| *:'                                  00800000
  10150.                 Exit rc                                                 00810000
  10151.                 End  /*  If  ..  Do  */                                 00820000
  10152.                                                                         00830000
  10153.             End  /*  If  ..  Do  */                                     00840000
  10154.                                                                         00850000
  10155.         End  /*  If  ..  Do  */                                         00860000
  10156.                                                                         00870000
  10157.     End  /*  If  ..  Do  */                                             00880000
  10158.                                                                         00890000
  10159. If ft = '*' Then Do                                                     00900000
  10160.                                                                         00910000
  10161.     Address "CMS" 'STATE' fn 'NAMES *'                                  00920000
  10162.     If rc = 0 Then Do                                                   00930000
  10163.                                                                         00940000
  10164.         'CALLPIPE COMMAND NAMEFIND :NICK . :AUTH :PIPE' ,               00950000
  10165.                 '(FILE' fn '| VAR AUTH | DROP' ,                        00960000
  10166.         '| CHANGE' '00'x || '&0' || '00'x || nick || '00'x ,            00970000
  10167.         '| CHANGE' '00'x || '&1' || '00'x ||  fn  || '00'x ,            00980000
  10168.         '| CHANGE' '00'x || '&2' || '00'x ||  ft  || '00'x ,            00990000
  10169.         '| CHANGE' '00'x || '&3' || '00'x ||  fm  || '00'x ,            01000000
  10170.         '| CHANGE' '00'x || '&4' || '00'x || menu || '00'x ,            01010000
  10171.                 '| VAR PIPE'                                            01020000
  10172.                                                                         01030000
  10173.         If rc = 0 Then Do                                               01040000
  10174.                                                                         01050000
  10175.             /*  if auth non-blank  */                                   01060000
  10176.             If ^gopsrvau(client,auth) Then Do                           01070000
  10177.                 /*  "access restricted"  */                             01080000
  10178.                 'CALLPIPE COMMAND XMITMSG 2380' ,                       01090000
  10179.                     '(CALLER GOP ERRMSG' ,                              01100000
  10180.                         '| SPEC /- / 1 1-* NEXT | *:'                   01110000
  10181.                 Exit rc                                                 01120000
  10182.                 End  /*  If  ..  Do  */                                 01130000
  10183.                                                                         01140000
  10184.             If pipe ^= "" Then Do                                       01150000
  10185.                 menu = fn                                               01160000
  10186.                 Address "COMMAND" 'GLOBALV SELECT GOPHERD PUT MENU'     01170000
  10187.                 'CALLPIPE' pipe '| *:'                                  01180000
  10188.                 Exit rc                                                 01190000
  10189.                 End  /*  If  ..  Do  */                                 01200000
  10190.                                                                         01210000
  10191.             End  /*  If  ..  Do  */                                     01220000
  10192.                                                                         01230000
  10193.         End  /*  If  ..  Do  */                                         01240000
  10194.                                                                         01250000
  10195.     End  /*  If  ..  Do  */                                             01260000
  10196.                                                                         01270000
  10197. If Index(fn ft, '*') = 0 Then Do                                        01280000
  10198.     Address "CMS" 'STATE' fn ft fm                                      01290000
  10199.     If rc = 0 Then Do                                                   01300000
  10200.         'CALLPIPE <' fn ft fm '| *:'                                    01310000
  10201.         Exit rc                                                         01320000
  10202.         End                                                             01330000
  10203.     Exit rc                                                             01340000
  10204.     End                                                                 01350000
  10205.                                                                         01360000
  10206. If Index(fn,'*') = 0 & ft = '*' Then Do                                 01370000
  10207.                                                                         01380000
  10208.     Address "COMMAND" 'GLOBALV SELECT GOPHERD SET MENU' fn              01390000
  10209.                                                                         01400000
  10210.     Address "CMS" 'STATE' fn 'FILELIST' fm                              01410000
  10211.     If  rc = 0  Then Do     /*  menu is a FILELIST  */                  01420000
  10212.         'CALLPIPE <' fn 'FILELIST' fm '| *:'                            01430000
  10213.         Exit rc                                                         01440000
  10214.         End  /*  If  ..  Do  */                                         01450000
  10215.                                                                         01460000
  10216.     If fm = '*' | fm = "" Then fm = 'A'                                 01470000
  10217.     'CALLPIPE COMMAND ACCESS +' || fm || '.' || fn fm                   01480000
  10218.     If rc = 0 Then Do                                                   01490000
  10219.         /*  menu is an SFS sub-directory  */                            01500000
  10220.         'CALLPIPE' arg0 '* *' fm '| *:'                                 01510000
  10221.         lrc = rc                                                        01520000
  10222.         'CALLPIPE COMMAND ACCESS -' || fm fm                            01530000
  10223.         Exit lrc                                                        01540000
  10224.         End  /*  If  ..  Do  */                                         01550000
  10225.     If rc = 28 | rc = 100 Then Exit rc                                  01560000
  10226.     End                                                                 01570000
  10227.                                                                         01580000
  10228. /*  shortcut for GOPSRVRP on LISTFILE not FILELIST  */                  01590000
  10229. 'OUTPUT' " "                                                            01600000
  10230. If rc ^= 0 Then Exit rc * (rc ^= 12)                                    01610000
  10231.                                                                         01620000
  10232. /*  list all files in this directory  */                                01630000
  10233. 'ADDPIPE COMMAND LISTFILE' fn ft fm '(ALLFILE ALLOC NOHEADER | *.INPUT:'01640000
  10234. If rc ^= 0 Then Do                                                      01650000
  10235.     'CALLPIPE COMMAND LISTFILE' fn ft fm '(NOHEADER | *:'               01660000
  10236.     Exit rc                                                             01670000
  10237.     End  /*  If  ..  Do  */                                             01680000
  10238.                                                                         01690000
  10239. /*  give SFS directories a filetype '*'  */                             01700000
  10240. Do Forever                                                              01710000
  10241.                                                                         01720000
  10242.     'PEEKTO RECORD'                                                     01730000
  10243.     If rc ^= 0 Then Leave                                               01740000
  10244.                                                                         01750000
  10245.     Parse Var record fn ft fm .                                         01760000
  10246.     If fm = "DIR" Then 'OUTPUT' "     " fn '*' ft                       01770000
  10247.                   Else 'OUTPUT' "     " fn ft fm                        01780000
  10248.                                                                         01790000
  10249.     'READTO'                                                            01800000
  10250.     If rc ^= 0 Then Leave                                               01810000
  10251.                                                                         01820000
  10252.     End  /*  If  ..  Do  Forever  */                                    01830000
  10253.                                                                         01840000
  10254. Exit rc * (rc ^= 12)                                                    01850000
  10255.                                                                         01860000
  10256. :READ  GOPSRVRP $REXX    A1 TMP200 01/25/93 15:24:33                            
  10257. /*                                                                      00010000
  10258.  *        Name: GOPSRVRP REXX                                           00020000
  10259.  *              resolve gopher paths (selector strings) recursively     00030000
  10260.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  10261.  *        Date: 1993-Jan-15, 19                                         00050000
  10262.  *                                                                      00060000
  10263.  *              This file is part of CMS Gopher.                        00070000
  10264.  */                                                                     00080000
  10265.                                                                         00090000
  10266. /*                                                                      00100000
  10267.  *      Copyright 1993 Richard M. Troth.   This software was developed  00110000
  10268.  *      with resources provided by Rice University and is intended      00120000
  10269.  *      to serve Rice's user community.   Rice has benefitted greatly   00130000
  10270.  *      from the free distribution of software,  therefore distribution 00140000
  10271.  *      of unmodified copies of this material is not restricted.        00150000
  10272.  *      You may change your own copy as needed.   Neither Rice          00160000
  10273.  *      University nor any of its employees or students shall be held   00170000
  10274.  *      liable for damages resulting from the use of this software.     00180000
  10275.  */                                                                     00190000
  10276.                                                                         00200000
  10277. Parse Source . . arg0 .                                                 00210000
  10278. Parse Arg nick '/' rest                                                 00220000
  10279. nick = Strip(nick)                                                      00230000
  10280. rest = Strip(rest)                                                      00240000
  10281.                                                                         00250000
  10282. Do While nick = ""      /*  deal with null parts w/o recursion  */      00260000
  10283.     If rest = "" Then Do; 'SHORT'; Exit rc; End                         00270000
  10284.     Parse Var rest nick '/' rest                                        00280000
  10285.     End  /*  Do  While  */                                              00290000
  10286. /*                                                                      00300000
  10287. If nick = "" Then Do    **  deal with null parts by recursion  **       00310000
  10288.     If rest = "" Then 'SHORT'                                           00320000
  10289.                  Else 'CALLPIPE *: |' arg0 rest '| *:'                  00330000
  10290.     Exit rc                                                             00340000
  10291.     End  **  If  ..  Do  **                                             00350000
  10292.  */                                                                     00360000
  10293.                                                                         00370000
  10294. /*  look for the shortcut on pure LISTFILE ouptut  */                   00380000
  10295. 'PEEKTO RECORD'                                                         00390000
  10296. If rc ^= 0 Then Exit rc * (rc ^= 12)                                    00400000
  10297. If Strip(record) = "" Then Signal SHORTCUT                              00410000
  10298.                                                                         00420000
  10299. /*  part = nick;  Upper part  */                                        00430000
  10300. Parse Upper Var nick part                                               00440000
  10301.                                                                         00450000
  10302. Do Forever                                                              00460000
  10303.                                                                         00470000
  10304.     'READTO RECORD'                                                     00480000
  10305.     If rc ^= 0 Then Leave                                               00490000
  10306.     If Left(record,1) = '*' Then Iterate                                00500000
  10307.     If Left(record,1) ^= ' ' Then Leave         /*  short cut  */       00510000
  10308.                                                                         00520000
  10309.     Parse Upper Var record fn ft fm fp '"' . "'" . '05'x .              00530000
  10310.     If Strip(fn) = "" Then Iterate                                      00540000
  10311.                                                                         00550000
  10312.     If  fp = "" Then  Select  /*  ft  */                                00560000
  10313.         When  Index(fn,'*') > 0 Then    fp = fn || '.' || ft            00570000
  10314.         When  ft = ""   | ft = "*"  | ,                                 00580000
  10315.               ft = "FILELIST"   Then    fp = fn                         00590000
  10316.         Otherwise                       fp = fn || '.' || ft            00600000
  10317.         End  /*  Select  ft  */                                         00610000
  10318.     If Strip(fp) ^= part Then Iterate                                   00620000
  10319.                                                                         00630000
  10320. Say "GOPSRVRP: matched" fn ft fm fp                                     00640000
  10321.     /*  found it!  */                                                   00650000
  10322.     /*  Parse Arg nick '/' .  */                                        00660000
  10323.     Address "COMMAND" 'GLOBALV SELECT GOPHERD PUT NICK'                 00670000
  10324.     If rest = "" Then 'CALLPIPE GOPSRVLS' fn ft fm '| *:'               00680000
  10325.                  Else 'CALLPIPE GOPSRVLS' fn ft fm '|' arg0 rest '| *:' 00690000
  10326.     /*  Leave  */  Exit rc                                              00700000
  10327.                                                                         00710000
  10328.     End                                                                 00720000
  10329.                                                                         00730000
  10330. FALLOUT:                                                                00740000
  10331. Say "GOPSRVRP: didn't find a match for" nick                            00750000
  10332. /*  fallout;  we didn't find a match in this menu  */                   00760000
  10333. /*  Parse Arg nick  */                                                  00770000
  10334. nick = nick || '/' || rest                                              00780000
  10335. Address "COMMAND" 'GLOBALV SELECT GOPHERD PUT NICK'                     00790000
  10336. 'CALLPIPE GOPSRVLS ? ? ? | *:'                                          00800000
  10337.                                                                         00810000
  10338. Exit rc                                                                 00820000
  10339.                                                                         00830000
  10340. SHORTCUT:                                                               00840000
  10341. Parse Var                                                               00850000
  10342. Say "GOPSRVRP: shortcut to" fn ft fm fp                                 00860000
  10343.     /*  found it!  */                                                   00870000
  10344.     /*  Parse Arg nick '/' .  */                                        00880000
  10345.     Address "COMMAND" 'GLOBALV SELECT GOPHERD PUT NICK'                 00890000
  10346.     If rest = "" Then 'CALLPIPE GOPSRVLS' fn ft fm '| *:'               00900000
  10347.                  Else 'CALLPIPE GOPSRVLS' fn ft fm '|' arg0 rest '| *:' 00910000
  10348.     /*  Leave  */  Exit rc                                              00920000
  10349.                                                                         00930000
  10350.                                                                         00940000
  10351. :READ  GOPSRVMB $REXX    A1 TMP200 01/25/93 15:24:29                            
  10352. /*                                                                      00010000
  10353.  *        Name: GOPSRVMB REXX                                           00020000
  10354.  *              CMS Gopher Server menu builder pipeline stage           00030000
  10355.  *              Based on the older GOPHERDM REXX stage from 2.3.        00040000
  10356.  *      Author: Rick Troth, Rice University, Information Systems        00050000
  10357.  *        Date: 1993-Jan-15                                             00060000
  10358.  */                                                                     00070000
  10359.                                                                         00080000
  10360. /*                                                                      00090000
  10361.  *      Copyright 1993 Richard M. Troth.   This software was developed  00100000
  10362.  *      with resources provided by Rice University and is intended      00110000
  10363.  *      to serve Rice's user community.   Rice has benefitted greatly   00120000
  10364.  *      from the free distribution of software,  therefore distribution 00130000
  10365.  *      of unmodified copies of this material is not restricted.        00140000
  10366.  *      You may change your own copy as needed.   Neither Rice          00150000
  10367.  *      University nor any of its employees or students shall be held   00160000
  10368.  *      liable for damages resulting from the use of this software.     00170000
  10369.  */                                                                     00180000
  10370.                                                                         00190000
  10371. uc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"                                       00200000
  10372. lc = "abcdefghijklmnopqrstuvwxyz"                                       00210000
  10373.                                                                         00220000
  10374. /*  sync with input  */                                                 00230000
  10375. 'PEEKTO'                                                                00240000
  10376. If rc ^= 0 Then Exit rc * (rc ^= 12)                                    00250000
  10377.                                                                         00260000
  10378. /*  experience shows that sometimes GLOBALV SELECT        *             00270000
  10379.  *  doesn't work unless you explicitly sync with PEEKTO   */            00280000
  10380. Address "COMMAND" 'GLOBALV SELECT GOPHERD GET HOST PORT PATH MENU'      00290000
  10381. localhost = host                                                        00300000
  10382. localport = port                                                        00310000
  10383. localpath = path                                                        00320000
  10384. Say "Global PATH =" path                                                00330000
  10385.                                                                         00340000
  10386. Do Forever                                                              00350000
  10387.                                                                         00360000
  10388.     'PEEKTO RECORD'                                                     00370000
  10389.     If rc ^= 0 Then Leave                                               00380000
  10390.                                                                         00390000
  10391.     key = Left(record,1)                                                00400000
  10392.     Select  /*  key  */                                                 00410000
  10393.         When key = "*" Then nop                                         00420000
  10394.         When Strip(record) = "" Then nop                                00430000
  10395.         When key = " " Then Call FILELIST                               00440000
  10396.         Otherwise           Call PREFAB                                 00450000
  10397.         End  /*  Select  key  */                                        00460000
  10398.     If rc ^= 0 Then Leave                                               00470000
  10399.                                                                         00480000
  10400.     'READTO'                                                            00490000
  10401.     If rc ^= 0 Then Leave                                               00500000
  10402.                                                                         00510000
  10403.     End  /*  Do  For  */                                                00520000
  10404.                                                                         00530000
  10405. Exit rc * (rc ^= 12)                                                    00540000
  10406.                                                                         00550000
  10407.                                                                         00560000
  10408.                                                                         00570000
  10409. /* ------------------------------------------------------------ FILELIST00580000
  10410.  *  We're apparently reading a plain FILELIST or LISTFILE output.       00590000
  10411.  */                                                                     00600000
  10412. FILELIST:                                                               00610000
  10413.                                                                         00620000
  10414. q1 = Index(record,"'")                                                  00630000
  10415. q2 = Index(record,'"')                                                  00640000
  10416. Select                                                                  00650000
  10417.     When  q1 = 0  & q2 = 0  Then                                        00660000
  10418.         Parse Var record fn ft fm fp '05'x name '05'x type '05'x .      00670000
  10419.     When  q1 = 0  Then                                                  00680000
  10420.         Parse Var record fn ft fm fp '"'name'"' type .                  00690000
  10421.     When  q2 = 0  Then                                                  00700000
  10422.         Parse Var record fn ft fm fp "'"name"'" type .                  00710000
  10423.     When  q1 > q2 Then                                                  00720000
  10424.         Parse Var record fn ft fm fp '"'name'"' type .                  00730000
  10425.     When  q2 > 0  Then                                                  00740000
  10426.         Parse Var record fn ft fm fp "'"name"'" type .                  00750000
  10427.     End  /*  Select  */                                                 00760000
  10428.                                                                         00770000
  10429. If ft = "" Then ft = "*"                                                00780000
  10430. If fm = "" Then fm = "*"                                                00790000
  10431. If ft = "GOPHER" | ft = "GOPLINK" Then Do                               00800000
  10432.     /*  read gopher link information  */                                00810000
  10433.     'CALLPIPE <' fn ft fm '| GOPSRVGL | *:'                             00820000
  10434.     Return                                                              00830000
  10435.     End                                                                 00840000
  10436.                                                                         00850000
  10437. /*  this is for Yossie:  hide filemode zero  */                         00860000
  10438. If Length(fm) > 1 Then If Substr(fm,2,1) = '0' Then Return              00870000
  10439.                                                                         00880000
  10440. fp = Strip(fp)                                                          00890000
  10441. If fp = "" Then Do                                                      00900000
  10442.     If  Index(fn ft, '*') > 0   | ,                                     00910000
  10443.         ft = "FILELIST"         Then fp = Translate(fn,lc,uc)           00920000
  10444.     Else  fp = Translate(fn||'.'||ft,lc,uc)                             00930000
  10445.     End  /*  If  ..  Do  */                                             00940000
  10446.                                                                         00950000
  10447. If name = "" Then name = fp     /*  default name is relative path  */   00960000
  10448. fp = Translate(fp,"%","/")        /*  no slashes in partial path!  */   00970000
  10449. If type = "" Then type = gtype(ft)                                      00980000
  10450. host = localhost                                                        00990000
  10451. port = localport                                                        01000000
  10452. path = type || localpath || '/' || fp                                   01010000
  10453.                                                                         01020000
  10454. /* read overrides from the NAMES file, if any */                        01030000
  10455. If menu ^= "" Then Call GOVER                                           01040000
  10456.                                                                         01050000
  10457. 'OUTPUT' type || name || '05'x || ,                                     01060000
  10458.       /* type */ path || '05'x || ,                                     01070000
  10459.                  host || '05'x || port                                  01080000
  10460.                                                                         01090000
  10461. Return                                                                  01100000
  10462.                                                                         01110000
  10463.                                                                         01120000
  10464.                                                                         01130000
  10465. /* -------------------------------------------------------------- PREFAB01140000
  10466.  *  Preceeding stage has supplied some of the parameters.  (thank you)  01150000
  10467.  */                                                                     01160000
  10468. PREFAB:                                                                 01170000
  10469.                                                                         01180000
  10470. Parse Var record name '05'x path '05'x host '05'x port '05'x rest       01190000
  10471. Parse Var path 1 type 2 path                                            01200000
  10472. path = type || localpath || '/' || path                                 01210000
  10473. If host = "" Then host = localhost                                      01220000
  10474. If port = "" Then port = localport                                      01230000
  10475. 'OUTPUT' name || '05'x || path || '05'x || ,                            01240000
  10476.          host || '05'x || port || '05'x || rest                         01250000
  10477. Return                                                                  01260000
  10478.                                                                         01270000
  10479.                                                                         01280000
  10480.                                                                         01290000
  10481. /* --------------------------------------------------------------- GOVER01300000
  10482.  *  Read the specified NAMES file for menu data overrides, if any.      01310000
  10483.  */                                                                     01320000
  10484. GOVER:                                                                  01330000
  10485.                                                                         01340000
  10486. Address "COMMAND" 'STATE' menu 'NAMES *'                                01350000
  10487. If rc ^= 0 Then Return                                                  01360000
  10488.                                                                         01370000
  10489. 'CALLPIPE COMMAND NAMEFIND :NICK' fp ,                                  01380000
  10490.         ':TYPE :NAME :PATH :HOST :PORT (FILE' menu ,                    01390000
  10491.         '| VAR _TYPE | DROP | VAR _NAME | DROP | VAR _PATH | DROP' ,    01400000
  10492.         '| VAR _HOST | DROP | VAR _PORT'                                01410000
  10493. If rc ^= 0 Then                                                         01420000
  10494. 'CALLPIPE COMMAND NAMEFIND :FN' fn ':FT' ft ,                           01430000
  10495.         ':TYPE :NAME :PATH :HOST :PORT (FILE' menu ,                    01440000
  10496.         '| VAR _TYPE | DROP | VAR _NAME | DROP | VAR _PATH | DROP' ,    01450000
  10497.         '| VAR _HOST | DROP | VAR _PORT'                                01460000
  10498. If rc ^= 0 Then Return                                                  01470000
  10499.                                                                         01480000
  10500. /*      defaults for  type, name, path, host, port    *                 01490000
  10501.  *      are supplied by the calling routine           */                01500000
  10502.                                                                         01510000
  10503. If _host ^= "" Then host = _host                                        01520000
  10504. If _port ^= "" Then port = _port                                        01530000
  10505. If _path ^= "" Then path = _path                                        01540000
  10506. If _name ^= "" Then name = _name                                        01550000
  10507. If _type ^= "" Then type = _type                                        01560000
  10508.                                                                         01570000
  10509. Select                                                                  01580000
  10510.     When _host ^= "" & _port = "" Then port = 70                        01590000
  10511.     When _host = "" & _port ^= "" Then host = localhost                 01600000
  10512.     Otherwise nop                                                       01610000
  10513.     End  /*  When  Select  */                                           01620000
  10514.                                                                         01630000
  10515. If _host ^= "" | _port ^= "" Then Do                                    01640000
  10516.     path = _path                                                        01650000
  10517.     type = _type                                                        01660000
  10518.     If type = "" Then type = "1"                                        01670000
  10519.     End  /*  If  ..  Do  */                                             01680000
  10520. Else If _type ^= "" & _path = "" Then                                   01690000
  10521.     path = _type || localpath || '/' || fp                              01700000
  10522.                                                                         01710000
  10523. Return                                                                  01720000
  10524.                                                                         01730000
  10525.                                                                         01740000
  10526.                                                                         01750000
  10527. /* --------------------------------------------------------------- GTYPE01760000
  10528.  * Returns the default Gopher type character for CMS filetype specified.01770000
  10529.  */                                                                     01780000
  10530. GTYPE:    Procedure                                                     01790000
  10531. Parse Arg ft                                                            01800000
  10532. Select  /*  ft  */                                                      01810000
  10533.     When ft = "*"        Then Return '1'                                01820000
  10534.     When ft = "-"        Then Return '1'                                01830000
  10535.     When ft = ""         Then Return '1'                                01840000
  10536.     When ft = "FILELIST" Then Return '1'                                01850000
  10537.     When ft = "GOPHER"   Then Return '1'                                01860000
  10538. /*  When ft = "CSO"      Then Return '2'  */                            01870000
  10539. /*  When ft = ?          Then Return '3'  */                            01880000
  10540. /*  When ft = "MAC"      Then Return '4'  */                            01890000
  10541. /*  When ft = "DOS"      Then Return '5'  */                            01900000
  10542.     When ft = "UUE"      Then Return '6'                                01910000
  10543. /*  When ft = "SEARCH"   Then Return '7'  */                            01920000
  10544. /*  When ft = "TELNET"   Then Return '8'  */                            01930000
  10545.     When ft = "TXT"      Then Return '0'    /*  plain text  */          01940000
  10546.     When ft = "TEXT"     Then Return '9'    /*  deck; not plain text  */01950000
  10547.     When ft = "TXTLIB"   Then Return '9'                                01960000
  10548.     When Left(ft,3) = "TXT" Then Return '9'                             01970000
  10549.     When ft = "CARDDUMP" Then Return '9'                                01980000
  10550.     When ft = "TAR"      Then Return '9'                                01990000
  10551.     When ft = "EXE"      Then Return '9'                                02000000
  10552.     When ft = "DVI"      Then Return '9'                                02010000
  10553.     When ft = "TFM"      Then Return '9'                                02020000
  10554.     When ft = "FMT"      Then Return '9'                                02030000
  10555.     When ft = "ADMGDF"   Then Return '9'                                02040000
  10556.     When ft = "ADMSYMBL" Then Return '9'                                02050000
  10557.     When ft = "SASUSER"  Then Return '9'                                02060000
  10558.     When ft = "SAS6USER" Then Return '9'                                02070000
  10559.     When ft = "SND"      Then Return 's'                                02080000
  10560. /*  When ft = "EPS"      Then Return 'p'  */                            02090000
  10561. /*  When ft = "PS"       Then Return 'p'  */                            02100000
  10562.     When ft = "MODULE"   Then Return 'v'                                02110000
  10563.     When ft = "LOADLIB"  Then Return 'v'                                02120000
  10564.     When ft = "XRX"      Then Return 'v'                                02130000
  10565.     When ft = "GIF"      Then Return 'I'                                02140000
  10566.     Otherwise                 Return '0'                                02150000
  10567.     End  /*  Select  ft  */                                             02160000
  10568.                                                                         02170000
  10569. :READ  GOPSRVGL $REXX    A1 TMP200 01/25/93 15:24:24                            
  10570. /*                                                                      00010000
  10571.  *        Name: GOPSRVGL REXX                                           00020000
  10572.  *              read and process a GOPHER (link) file for GOPHERD       00030000
  10573.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  10574.  *        Date: 1993-Jan-15                                             00050000
  10575.  */                                                                     00060000
  10576.                                                                         00070000
  10577. /*                                                                      00080000
  10578.  *      Copyright 1993 Richard M. Troth.   This software was developed  00090000
  10579.  *      with resources provided by Rice University and is intended      00100000
  10580.  *      to serve Rice's user community.   Rice has benefitted greatly   00110000
  10581.  *      from the free distribution of software,  therefore distribution 00120000
  10582.  *      of unmodified copies of this material is not restricted.        00130000
  10583.  *      You may change your own copy as needed.   Neither Rice          00140000
  10584.  *      University nor any of its employees or students shall be held   00150000
  10585.  *      liable for damages resulting from the use of this software.     00160000
  10586.  */                                                                     00170000
  10587.                                                                         00180000
  10588. Address "COMMAND" 'GLOBALV SELECT GOPHERD GET HOST PORT'                00190000
  10589. localhost = host;   localport = port                                    00200000
  10590. host = "";  port = "";  path = "";  name = "";  type = ""               00210000
  10591.                                                                         00220000
  10592. Do Forever                                                              00230000
  10593.                                                                         00240000
  10594.     'PEEKTO RECORD'                                                     00250000
  10595.     If rc ^= 0 Then Leave                                               00260000
  10596.                                                                         00270000
  10597.     If Left(record,1) = '*' Then Call WRITELINK                         00280000
  10598.     If Left(record,1) = '#' Then Call WRITELINK                         00290000
  10599.     If rc ^= 0 Then Leave                                               00300000
  10600.                                                                         00310000
  10601.     Parse Var record var '=' val                                        00320000
  10602.     Upper var; var = Strip(var)                                         00330000
  10603.     Select  /*  var  */                                                 00340000
  10604.         When var = "TYPE" Then type = Strip(val)                        00350000
  10605.         When var = "NAME" Then name = val                               00360000
  10606.         When var = "PATH" Then path = val                               00370000
  10607.         When var = "HOST" Then host = Strip(val)                        00380000
  10608.         When var = "PORT" Then port = Strip(val)                        00390000
  10609.         Otherwise nop   /*  ignore invalid lines  */                    00400000
  10610.         End  /*  Select  var  */                                        00410000
  10611.                                                                         00420000
  10612.     'READTO'                                                            00430000
  10613.     If rc ^= 0 Then Leave                                               00440000
  10614.                                                                         00450000
  10615.     End  /*  Do  Forever  */                                            00460000
  10616.                                                                         00470000
  10617. If rc = 12 Then Call WRITELINK                                          00480000
  10618.                                                                         00490000
  10619. Exit rc * (rc ^= 12)                                                    00500000
  10620.                                                                         00510000
  10621.                                                                         00520000
  10622.                                                                         00530000
  10623. /* ----------------------------------------------------------- WRITELINK00540000
  10624.  *  Looks like a break.  Iff we have everthing,                         00550000
  10625.  *  then write this link and reset the variables to empty strings.      00560000
  10626.  */                                                                     00570000
  10627. WRITELINK:                                                              00580000
  10628. If  name = "" | type = "" Then  Return                                  00590000
  10629. If  host = ""   Then host = localhost                                   00600000
  10630. If  host = "+"  Then host = localhost                                   00610000
  10631. If  type = "FILE"       Then type = '0'                                 00620000
  10632. If  type = "DIRECTORY"  Then type = '1'                                 00630000
  10633. If  port = "" Then                                                      00640000
  10634. Select  /*  type  */                                                    00650000
  10635.     When  type = '2'  Then port = '105'                                 00660000
  10636.     When  type = '8'  Then port = '23'                                  00670000
  10637.     When  type = 'T'  Then port = '23'                                  00680000
  10638.     Otherwise port = '70'                                               00690000
  10639.     End  /*  Select  type  */                                           00700000
  10640. 'OUTPUT' type || name || '05'x || path || '05'x ,                       00710000
  10641.               || host || '05'x || port                                  00720000
  10642. host = "";  port = "";  path = "";  name = "";  type = ""               00730000
  10643. Return                                                                  00740000
  10644.                                                                         00750000
  10645. :READ  GOPSRVAU $EXEC    A1 TMP200 01/25/93 15:24:19                            
  10646. /*                                                                      00010000
  10647.  *        Name: GOPSRVAU EXEC, authorization function                   00020000
  10648.  *              returns TRUE (1) if the file/menu may be retrieved      00030000
  10649.  *              returns FALSE (0) otherwise                             00040000
  10650.  *        Date: 1993-Jan-18                                             00050000
  10651.  *      Author: Rick Troth, Rice University, Information Systems        00060000
  10652.  *                                                                      00070000
  10653.  *              This file is part of CMS Gopher.                        00080000
  10654.  */                                                                     00090000
  10655.                                                                         00100000
  10656. /*                                                                      00110000
  10657.  *      Copyright 1993 Richard M. Troth.   This software was developed  00120000
  10658.  *      with resources provided by Rice University and is intended      00130000
  10659.  *      to serve Rice's user community.   Rice has benefitted greatly   00140000
  10660.  *      from the free distribution of software,  therefore distribution 00150000
  10661.  *      of unmodified copies of this material is not restricted.        00160000
  10662.  *      You may change your own copy as needed.   Neither Rice          00170000
  10663.  *      University nor any of its employees or students shall be held   00180000
  10664.  *      liable for damages resulting from the use of this software.     00190000
  10665.  */                                                                     00200000
  10666.                                                                         00210000
  10667. /* ---------------------------------------------------------- AUTHORIZED00220000
  10668.  * Verify that the client is allowed access, based on IP addr or name.  00230000
  10669.  * (we originally used an internal routine called IPA2C(),  but Arty's  00240000
  10670.  * RXSOCKET provides an Inet_addr() function,  which is now preferred)  00250000
  10671.  */                                                                     00260000
  10672. AUTHORIZED:                                                             00270000
  10673. Parse Upper Arg Client,AuthList                                         00280000
  10674. If AuthList = "" Then Return 1                                          00290000
  10675. ClientAddr = Inet_addr(Client)                                          00300000
  10676.                                                                         00310000
  10677. rc = Socket('GetHostByAddr', ClientAddr, 'ClientName')                  00320000
  10678. If rc = "-1" Then ClientName = Client                                   00330000
  10679. Say "Client looks like" ClientName Inet_ntoa(ClientAddr)                00340000
  10680. Upper ClientName                                                        00350000
  10681.                                                                         00360000
  10682. allow = 1                                                               00370000
  10683. Do While AuthList ^= ""                                                 00380000
  10684.                                                                         00390000
  10685.     Parse Var AuthList Auth AuthList                                    00400000
  10686.     If Auth = "DENY" Then Do                                            00410000
  10687.         allow = 0; Parse Var AuthList Auth AuthList                     00420000
  10688.         End  /*  If  ..  Do  */                                         00430000
  10689.     If Auth = "ALLOW" Then Do                                           00440000
  10690.         allow = 1; Parse Var AuthList Auth AuthList                     00450000
  10691.         End  /*  If  ..  Do  */                                         00460000
  10692.     Say "Auth" Auth                                                     00470000
  10693.     If Auth = '*' Then Return allow                                     00480000
  10694.                                                                         00490000
  10695.     Parse Var Auth Auth "," AuthMask "," .                              00500000
  10696.     AuthAddr = Inet_addr(Auth)                                          00510000
  10697.     If AuthAddr = "-1" Then Do              /* process as a name spec */00520000
  10698.         If Left(Auth,1) = '.' Then Do                                   00530000
  10699.             TruncName = Right(ClientName,Length(Auth))                  00540000
  10700.             Say "Truncated ClientName" TruncName                        00550000
  10701.             If TruncName = Auth Then Return allow                       00560000
  10702.             End  /*  If  ..  Do  */                                     00570000
  10703.         Else If ClientName = Auth Then Return allow                     00580000
  10704.         End  /*  If  ..  Do  */                                         00590000
  10705.                                                                         00600000
  10706.     Else Do                                 /* must be a numeric spec */00610000
  10707.         AuthMask = Inet_addr(AuthMask)                                  00620000
  10708.         If AuthMask = "-1" Then Do                                      00630000
  10709.             AuthMask = bitand(AuthAddr,'C0000000'x)                     00640000
  10710.             Select  /*  AuthMask  */                                    00650000
  10711.                 When AuthMask = '00000000'x Then AuthMask = 'FF000000'x 00660000
  10712.                 When AuthMask = '80000000'x Then AuthMask = 'FFFF0000'x 00670000
  10713.                 When AuthMask = 'C0000000'x Then AuthMask = 'FFFFFF00'x 00680000
  10714.                 End  /*  Select  AuthMask  */                           00690000
  10715.             End  /*  If  ..  Do  */                                     00700000
  10716.         Say "ADDR" c2x(AuthAddr) "MASK" c2x(AuthMask)                   00710000
  10717.         AuthAddr = bitxor(AuthAddr,ClientAddr)                          00720000
  10718.         AuthAddr = bitand(AuthAddr,AuthMask)                            00730000
  10719.         If AuthAddr = '00000000'x Then Return allow                     00740000
  10720.         End  /*  Else  Do  */                                           00750000
  10721.                                                                         00760000
  10722.     End  /*  Do  While  */                                              00770000
  10723.                                                                         00780000
  10724. Return 0                                                                00790000
  10725.                                                                         00800000
  10726. :READ  GOPSRVYS $REXX    A1 TMP200 01/22/93 15:41:34                            
  10727. /*                                                                              
  10728.  *        Name: GOPSRVYS REXX                                                   
  10729.  *              Gopher Server Search Engine utilizing WISHLP                    
  10730.  *              Original by Yossie Silverman <YOSSIE@UCSFVM>                    
  10731.  *                                                                              
  10732.  *   To create a search item do the following:                                  
  10733.  *                                                                              
  10734.  *     1) Create a standard gopher FILELIST of all files to be                  
  10735.  *        searched.  (Only ' fn ft fm title' will work, fm can                  
  10736.  *        (and should) be *                                                     
  10737.  *     2) GOPGEN INDEX menu                                                     
  10738.  *     3) Put the name and title of the searched menu                           
  10739.  *        in the menu you want to access it from (parent)                       
  10740.  *     4) Mark the searched menu as Type 7 either                               
  10741.  *        with a NAMES file or in the parent menu.                              
  10742.  */                                                                             
  10743.                                                                                 
  10744. Parse Arg search                            /* retrieve search string */        
  10745.                                                                                 
  10746. 'PEEKTO'            /*  sync with input  */                                     
  10747.                                                                                 
  10748. Address "COMMAND" 'GLOBALV SELECT GOPHERD GET MENU FM'                          
  10749. 'CALLPIPE COMMAND LISTFILE' menu 'GOPINDEX * (NOHEADER' ,                       
  10750.         '| VAR FILESPEC'                                                        
  10751. If rc ^= 0 Then Exit rc                                                         
  10752. Parse Var filespec . . fm .                                                     
  10753. Say "GOPSRVYS: MENU =" menu '-' fm                                              
  10754. 'CALLPIPE COMMAND WISHLP' menu 'GOPINDEX' fm search ,                           
  10755.         '| SPEC /      / 1 1-* NEXT | *:'                                       
  10756.                                                                                 
  10757. Exit rc                                                                         
  10758.                                                                                 
  10759. :READ  VMGOPHER CNTRL    A1 TMP200 01/22/93 11:00:56                            
  10760. TEXT MACS                                                                       
  10761. TEXT AUXGOP24                                                                   
  10762. *LCL AUXLCL                                                                     
  10763.